Monday, July 5, 2010

Map and unmap IPC$ with VBscript

I assume you know what an IPC$ mapping is for.

This will create the mapping:

dim objNetwork: Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "", "\\ser\IPC$", False, "user", "password"

And this will remove the mapping:

dim objNetwork: Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemoveNetworkDrive "\\ser\IPC$", True