tblackwellMemberJul 14, 2015 at 3:25 pm #165532
Hey guys, new here trying to learn what I can.
I use MDT to image computers and add them to a domain and specific OU. However the issue I am facing is all of the OUs in my domain have a legal disclaimer page that is blocking the task sequence from continuing.
What I did was built an OU specifically for deployments that disregards that policy. However what my goal was at the end of the task sequence I add it to an AD group using a script file I found online that works flawlessly. I’ve attempted to modify it to do the same thing except change the OU rather than adding it to an ADGroup, but my VBS knowledge is having trouble reading the code to make the modifications, I just don’t know all the variable meanings yet.
This is the original script I’m looking at that uses the customsettings.ini file to add it to the AD group. I’ve added the variables to the .ini file that will be used with the newly built script. I just know there is something basic I’m missing here.
Here is the .ini file settings in MDT I’m using currently:
Properties=MyCustomProperty, ADGroup, MoveOU
_SMSTSOrgName=Running %TaskSequenceID% on %OSDComputername%
TimeZoneName=Central Standard Time
;AD Group variable for New Workstations AD group
ADGroup = LDAP://CN=****,OU=****,OU=****,OU=****,DC=****,DC=****
;Move OU variable for Workstations OU move
MoveOU = LDAP://OU=****,DC=****,DC=****
This is the script I use for the ADGroup one, I was hoping I could do something similar for the MoveOU one, so I could call it at the end of my task sequence, followed by a gpupdate and then the reboot to log out the local admin account.
On Error Resume Next
iRetVal = ZTIProcess
On Error Goto 0
iRetVal = Success
ZTIProcess = iRetval
Const ADS_PROPERTY_APPEND = 3
Dim sGroup, oGroup, oADSYS, sComputerDN
'Set AD Group
oLogging.CreateEntry "Add current computer to AD Security Group", LogTypeInfo
sGroup = oEnvironment.Item("ADGroup")
Set oGroup = GetObject (sGroup)
oLogging.CreateEntry "Target Group Distinguised Name is: " & sGroup , LogTypeInfo
'Get current Computers Distinguised Name from Active Directory
oLogging.CreateEntry "Getting Computers Distinguised Name from Active Directory", LogTypeInfo
Set oADSys = CreateObject("ADSystemInfo")
sComputerDN = oADSys.ComputerName
oLogging.CreateEntry "Computer Object Distinguised Name is: " & sComputerDN , LogTypeInfo
oLogging.CreateEntry "Adding computer object to group: " & sGroup, LogTypeInfo
'Add Member to Group
oGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(sComputerDN)
oLogging.CreateEntry "Finished script.", LogTypeInfo
Is this possible? Please help or advise.
You must be logged in to reply to this topic.