Conditionally map/unmap a network drive?

BigToque

Lifer
Oct 10, 1999
11,700
0
76
I'm using Windows 8 and I'm frequently moving between home and school. When I'm at school, I need to map a couple of network drives.

I'm just curious if there's a script I can create that runs at login (or that monitors a network device IP address), and then maps and unmaps the network drives when the connection is / is not available.
 

Mushkins

Golden Member
Feb 11, 2013
1,631
0
0
Frankly, i'd just map them all to separate letters. If you're on the wrong network it'll just throw a "cant reconnect all network drives" and show you a big red X over the ones on the other network. It'll connect to the ones for the network you're actually on just fine as you switch networks.
 
Oct 19, 2000
17,860
4
81
I'm using Windows 8 and I'm frequently moving between home and school. When I'm at school, I need to map a couple of network drives.

I'm just curious if there's a script I can create that runs at login (or that monitors a network device IP address), and then maps and unmaps the network drives when the connection is / is not available.

This sounds doable but would require Powershell. Pull the current IP and do a if statement to unmap/map.
 

jkauff

Senior member
Oct 4, 2012
583
13
81
The batch file is the way to go. Win 8 doesn't recognize .bat files out of the box, so put the file on your desktop, double-click, and Win 8 will ask you what program to use to open the file. Navigate to cmd.exe (in Windows\System32 folder), select it, and next time Windows will remember how to open a .bat file. You can also use "Open with..." from the right-click menu and do the same thing.

Run the batch file when you're connected to the network.
 
Last edited: