vbscript to put in login to send pc that you are logged into to AD P.O. Box fileld

chasmant
chasmant used Ask the Experts™
on
Looking for a script that would add the pc name to the P.O. Box field in AD during login
We are using windows 7 as pc's
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Manager, IT
Top Expert 2008
Commented:
Here you go.
on error resume next

set wshnetwork = createobject("wscript.network")
strComputername = wshnetwork.computername

Set oADSysInfo = CreateObject("ADSystemInfo")
userDN = oADSysInfo.UserName
userDN = "LDAP://" & userDN
if userDN <> "" then
	Set objUser = GetObject (userDN) 
	objUser.Put "postOfficeBox", strComputername
	objUser.SetInfo
end if

Open in new window

Author

Commented:
thanks really appreciate the fast response
rejoinderManager, IT
Top Expert 2008

Commented:
You are welcome and thank you for the points :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial