I found markdmac's logonscript faq that retrives dhcp address and do some things with it. Now i'm trying to do the same but with static address. I get an error in select row. Select Case Left (ActiveIPAddress, 10)
Error: 800A000D - Type mismatch
Source: Microsoft VBScript runtime error.
pls help..
Error: 800A000D - Type mismatch
Source: Microsoft VBScript runtime error.
pls help..
Code:
OPTION EXPLICIT
Dim oReg
Dim WSHShell
Dim strKeyPath
Dim arrSubKeys
Dim subkey
Dim IPAddr
Dim ActiveIPAddress
'On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
Set WSHShell = wscript.CreateObject("Wscript.Shell")
strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
IPAddr = WSHShell.RegRead("HKLM\" & strKeyPath & subkey & "\IPAddress")
ActiveIPAddress = IPAddr
Next
Select Case Left (ActiveIPAddress, 10)
Case "192.168.1."
msgbox "Your subnet is 192.168.1.x"
Case "192.168.2."
msgbox "Your subnet is 192.168.2.x"
Case "192.168.3."
msgbox "Your subnet is 192.168.3.x"
End Select