Tuesday, January 25, 2011

Moving AD Objects Via VBS

Sometimes in AD reorganization of objects needs to occur to ease management. With a high number of objects, it might be more convientient to do this programatically. Lucily Microsoft has mad this task some what painless with VB Scripting. The process involves essentially three steps:

1. Create a scripting object to the new OU in AD where this object is to move

2. Create a scripting object to the original AD object

3. Use the MoveHere method of the new OU object to move the original object to that location

Example:

Say a computer account exists under the OU tree OU=Desktops,OU=Company,dc=location,dc=local. Let us assume that this computer account is called MYPC. Additionally, it is desired to move this account to the OU tree defined at OU=NewOU,dc=location,dc=local. Here's a sample scripts to do this for you

-------

szNewLoc="OU=NewOU,dc=location,dc=local"

szOldObj="CN=MYPC,OU=Desktops,OU=Company,dc=location,dc=local"

set oNewOU=GetObject("LDAP://" & szNewLoc)

set oCpu=GetObject("LDAP://" & szOldObj)

oNewOU.MoveHere oCpu.ADsPath, oCpu.Name

---

That it. Now lets decipher the script.

Lines 1 and 2 set string variables to the new OU and the original object

Line 3: creates a scripting object identifying the new storage location

Line 4. Creates a scripting object identifying the original object

Line 5: This does the actual move of the object. The MoveHere method, moves the source object (identified by the oCpu.Name property) from the original path (identified by the ADsPath property) the the location of the object oNewOU.

Monday, January 3, 2011

Caveats when setting Internet Explorer Proxy Settings Via GPO

When configuring a proxy server to work in a windows domain, it is often convienient to set a GPO for IE8 to enforce the correct settings. However, there are time when certain web site access must bypass the proxy settings. For this reason, the GPO editor under User Configuration/Policies/Windows Settings/Internet Explorer Maintenance/Connections/Proxy Settings has a section to enter exceptions. Make careful note that when entering information in this section, there are NO [ / ] characters. Doing so will bypass the proxy for all web sites.