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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map drives depending of the ip address.....?

Status
Not open for further replies.

diembi

Programmer
Sep 22, 2001
238
ES
Hello,
I need map drivers when the user login on the NT workstation depending of the ip address. I would like do it using wsh.

Thanks for all and regards...

Dani
 
To determine the local IP address, use:

On Error Resume Next
Set oWS = WScript.CreateObject("MSWinSock.WinSock")
If Err.Number = 0 Then
WScript.Echo oWS.LocalIP
Set oWS = Nothing
Else
WScript.Echo "Winsock not installed"
End If

To map the drive, you can use either the Network object of the WSH or the NET USE command:

IF IP = "X.X.X.X" THEN
Set oNetwork = WScript.CreateObject("WScript.network")
oNetwork.MapNetWorkDrive "K:","\\Server\Share"
ELSE
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run "command.com /C NET USE K: \\Server\Share",0
END IF Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top