Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script mapping drives not working.

Status
Not open for further replies.

Deeem

Technical User
Aug 20, 2004
64
GB
Hi guys,

Im using the script below to map some drives. Its saying network location not found, but when I try it in the mycomputer location bar it works fine.

Set WSHNetwork = CreateObject("WScript.Network")

WSHNetwork.MapNetworkDrive "S:", "\\ictserv\staff"
WSHNetwork.MapNetworkDrive "T:", "\\ictserv\backups\%username%"

set WSHNetwork = Nothing

wscript.quit

Any ideas?
 

Code:
Set WSHNetwork = CreateObject("WScript.Network")
UserString = WSHNetwork.UserName

WSHNetwork.MapNetworkDrive "S:", "\\ictserv\staff"
WSHNetwork.MapNetworkDrive "T:", "\\ictserv\backups\" & UserString

set WSHNetwork = Nothing

wscript.quit



I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Lol thanks for that, forgot to post saying ive fixed it cheers anyway mark "again" lol

Regards

Damon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top