Improve company productivity with a Business Account.Sign Up
Set dctSites = CreateObject("Scripting.Dictionary")
dctSites.CompareMode = vbTextCompare
dctSites.Add "Site1", "OU=Computers,OU=Site1,DC=domain,DC=com"
dctSites.Add "Site2", "OU=Computers,OU=Site2,DC=domain,DC=com"
Set objADSysInfo = CreateObject("ADSystemInfo")
strComputer = objADSysInfo.ComputerName
strSite = objADSysInfo.SiteName
If dctSites.Exists(strSite) = True Then
strNewOU = dctSites(strSite)
On Error Resume Next
Set objOU = GetObject("LDAP://" & strNewOU)
If Err.Number = 0 Then
On Error GoTo 0
WScript.Echo "Moving " & strComputer & " to " & strNewOU
intReturn = objOU.MoveHere("LDAP://CN=atl-ws-01,OU=Finance,DC=fabrikam,DC=com", vbNullString)
If intReturn = 0 Then
WScript.Echo "Move successful."
WScript.Echo "Move failed with return code " & intReturn & "."
WScript.Echo "Error binding to target OU of " & strNewOU & ". Error " & Err.Number & ": " & Err.Description
On Error GoTo 0
WScript.Echo strSite & " does not have an associated OU."
Open in new window
Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.