mat.viguier
mat.viguier

Reputation: 135

How to invoke "map a network drive"?

I'm using a script which is calling (via sh.run) "net use". On the first computer, net is allowed to be run by my user. On the second one, net is an unauthorized command (restricted by a domain policy).

Could I simply copy/rename/move the net.exe in order to execute it, even if it is not allowed? If not, is there a way to invoke the "GUI style" connector?

Upvotes: 0

Views: 236

Answers (1)

SeanC
SeanC

Reputation: 15923

Example of how to connect H: to \\myserver\users

Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strLocalDrive = "H:"
strRemoteShare = "\\myserver\users"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, False

Upvotes: 2

Related Questions