I want to run some auditing software using the login script but want to it by the IP address of the machine. Does anyone know of a way to set the login script to query the workstation for its ip address?
And here is the script in case you can't open the link:
Description
Returns the IP address for each IP-enabled network adapter installed in a computer.
Script Code
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2"
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE"
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next
I forgot to mention though that its a kix script. Anyway I've solved it and this is an example of the script:
;##### Audit Software to run on seperat VLAN#####
$IP=@IPADDRESS0 ;get the workstation ip address
$IP=substr($IP, 1, 11) ;chop off the network portion
$vLAN2="172. 29.100" ;VLAN 2
$vLAN3="172. 29.101" ;VLAN 3
$vLAN4="172. 29.110" ;VLAN 4
$vLAN5="172. 29.111" ;VLAN 5
$vLAN6="172. 29.120" ;VLAN 6
$vLAN7="172. 29.121" ;OBP VLAN 7
;##### Execute Auditing Software#####
IF $IP=$vLAN2 ;
shell "\\servername\whatever\whatever\audit.exe"
ENDIF
The first line gets the ip address of the workstation
The second line gets the first three parts of the ip address (the last one not important as I wanted to audit subnets of the network independantly.)
The next lot of lines describe the subnets values
To execute select the subnet you want to audit and hey presto. Done
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.