locked
Moving a system from one OU to another in MDT. RRS feed

  • Question

  • Hi all,

    I've been using MDT for a while now, and have fully automated everything except for naming the hostname itself, since the workstations we load each have user specific names.

    The issue I'm having is with one part regarding the legal disclaimer screen that stops the task sequence. I've done a lot of research and have found this is a known issue. However we built an OU for deployments that excludes the domain policy that puts the legal notice on there.

    What I've done is set the default OU in MDT as the deployment OU. What I'm trying to accomplish is run a script that will move it into another OU at the end of the deployment, run a gpupdate then reboot.

    I have another script I found online that works flawlessly for adding it to an AD Group. It uses a variable I set in the customsettings.ini and adds it to a AD Group automatically for me, I was hoping I could modify the code to something similar to move the OU in the same way, which is where I'm having issues.

    Here's what my customsettings.ini looks like currently, it works perfectly right now, just the system finishes up in the wrong OU. I bolded and set to italic the parts regarding the move OU script declaration and variable.

    [Settings]
    Priority=Default
    Properties=MyCustomProperty, ADGroup, MoveOU

    [Default]
    _SMSTSOrgName=Running %TaskSequenceID% on %OSDComputername%

    SkipBDDWelcome=YES
    UserID=****
    UserPassword=****
    UserDomain=****
    SkipAdminPassword=YES
    OSInstall=YES
    SkipCapture=NO
    AdminPassword=****
    SkipAdminPassword=YES
    SkipProductKey=YES
    SkipComputerBackup=YES
    SkipBitLocker=YES
    SkipTimeZone=YES
    SkipLocaleSelection=YES
    TimeZoneName=Central Standard Time
    SkipUserData=YES

    JoinDomain=****
    DomainAdmin=****
    DomainAdminDomain=****
    DomainAdminPassword=****

    MachineObjectOU=OU=Deployment,DC=****,DC=com

    ;AD Group variable for New Workstations AD group
    ADGroup = LDAP://CN=****,OU=Workstations,OU=****,OU=****,DC=****,DC=****

    ;Move OU variable for Workstations OU move
    MoveOU = LDAP://OU=Deployment,DC=****,DC=****

    SkipSummary=YES
    SkipFinalSummary=YES
    FinishAction=REBOOT

    ---------------------------------------------------------------------------------------------------------

    This is the script I found online that adds it to an AD group, calling the variables it needs from the customsettings.ini:

    <job id="Add-Computer-To-Group">
    < script language="VBScript" src="ZTIUtility.vbs"/>
    < script language="VBScript">

    Option Explicit

    Dim iRetVal

    On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    On Error Goto 0

    Function ZTIProcess()

    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)

    oGroup.SetInfo

    oLogging.CreateEntry "Finished script.", LogTypeInfo

    End Function

    < /script>
    < /job>

    Any help or advisement would be greatly appreciated.





    Wednesday, July 15, 2015 4:34 PM