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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.