option explicit
Dim objADInfo, objUser, strUser, strCity, wshshell
'get the username in DN format
Set objADInfo = CreateObject("ADSystemInfo")
strUser = objADInfo.UserName
'query the city from AD
Set objUser = GetObject("LDAP://" & strUser)
strCity = objUser.Get("l")
'invoke a shell calling application.exe
Set WshShell = WScript.CreateObject("WScript.Shell")
wshShell.Run "application.exe " & strCity, 1, TRUE
|