Hi,

i'm calling from my VPN client separate script other then the normal logon script in the user profile.
Because the connecting pc's have multipli ip-addresses i use this FindLANaddress function to query from where the client is starting the script.
I also use the Ping function to test connectivity to the server.

 Code:
Function FindLANaddress($AddressToFind)
	$nul=setoption("NoMacrosinstrings","on")
	$nul=setoption("NoVarsinstrings","on")
	For $i = 0 to 5
   $ret = execute("$IP=@IPADDRESS" + $i)
   If InStr($IP,$AddressToFind)
		$FindLANaddress = $IP
   EndIf
	Next
	$nul=setoption("NoMacrosinstrings","OFF")
	$nul=setoption("NoVarsinstrings","OFF")
EndFunction

Function Ping($CompIP, optional $Logout)
	$Count = 6000
	DO
		SHELL '%Comspec% /C ping -n 1 ' + $CompIP + ' | find /C "10.30" > nul'				
		IF ( @error = 0 AND NOT $Logout) OR (@error = 1 and $Logout)
			$Ping = 1					
			EXIT 0			
		ENDIF			
		SLEEP 1
	$Count = $Count -1
	UNTIL $Count = 0
EndFunction


Main program:
 Code:
$ServerToPing = "Server1"
IF Ping($ServerToPing) = 1 AND FindLANaddress("10. 90.  7") 
...


and then i should query the AD user profile for the logon script setting.
There are 4 different sites that use a separate script, however when users are at another site they should get there default script (cfr user profile) and not the script linked to the sites.

I found already this part on the site however i'm not able to select the "login script" parameter because i don't know the syntax.
where could find a list of the $objUser.xxxx parameters?

 Code:
$objSysInfo = CreateObject("ADSystemInfo") 
$strComputerDN = $objSysInfo.computerName 
$strUserDN = $objSysInfo.userName 

$strUserOU=Split($strUserDN,"OU=")
$strUserOU[0]=""
$strUserOU=Join($strUserOU,"OU=")

$strComputerOU=Split($strComputerDN,"OU=")
$strComputerOU[0]=""
$strComputerOU=Join($strComputerOU,"OU=")


"Information from ADSystemInfo"+@CRLF
"-----------------------------"+@CRLF
"           User DN: "+$strUserDN+@CRLF
"    User container: "+$strUserOU+@CRLF
"       Computer DN: "+$strComputerDN+@CRLF
"Computer container: "+$strComputerOU+@CRLF
@CRLF

"Information from AD User & Computer objects"+@CRLF
"-------------------------------------------"+@CRLF
$objComputer = GetObject("LDAP://" + $strComputerDN)
$objUser = GetObject("LDAP://" + $strUserDN)

"           User cn: "+$objUser.cn+@CRLF
"         User mail: "+$objUser.mail+@CRLF
"       Computer OS: "+$objComputer.operatingSystem+@CRLF


Edited by Benny69 (2008-11-25 05:27 PM)
Edit Reason: I added Code Tags