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

chasmant used Ask the Experts™
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
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Manager, IT
Top Expert 2008
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
end if

Open in new window


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

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