Scripting Question

Sysprep, K2000 and scripts...

11/21/2013 3084 views

Hi everyone,

i'm starting to get lost right now with K2000 and i may need your help.


I want to deploy some K-image ( software and personalisation included so ), sysprep used with a custom unattend.xml used. Where i'm stuck is : i can't name my computer when deploying the os. Next to this i want an automatic join on a specific domain and OU.


In all line : sysprep goes well, not the post task. Any idea ?

2 Comments   [ + ] Show comments


  • I have the answer to your both your queries, but I'll try and help you figure it out as it's better for learning!

    Have you created a pre-installation task for the computer name? I'm assuming your deploying a Windows OS?
  • Windows only ( for now ) yes, and i have a task using GetComputername.vbs

All Answers


I leave the computer name parameter out of the xml answer file so it will always prompt for name if you do not use the get/apply computer name tasks supplied with kace

        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


Answered 11/21/2013 by: SMal.tmcc
Red Belt

  • it seems the default task for the get/set computername don't work. Keeps telling me " unable to open file ", and yes in the xml file i removed the line as well ;)
    • I use this get/set name
      • do you have something for domain join and for specific OU ?
      • If the machine names are not already in Ad we create all of our machines in AD prior to imaging so we do not have to worry about OU placement.
        You can use powershell in post to add to specific domain OU.

        We reimage twice a year and do not remove the old names just reuse them and have never had a problem yet.

        I use the join_domain.vbs kace supplies in post script (I put the file in my images instead of downloading from the ikbox everytime)

        This is the line I use in my post process.

        start /wait cscript.exe -b c:\windows\w2d\join_domain.vbs Domain.name DomainUser password

        for me:
        start /wait cscript.exe -b c:\windows\w2d\join_domain.vbs tmccacad.tmcc.edu installer password

        This is the script file:

        Const JOIN_DOMAIN = 1
        Const ACCT_CREATE = 2
        Const ACCT_DELETE = 4
        Const WIN9X_UPGRADE = 16
        Const DOMAIN_JOIN_IF_JOINED = 32
        Const JOIN_UNSECURE = 64
        Const DEFERRED_SPN_SET = 256
        Const INSTALL_INVOCATION = 262144

        If WScript.Arguments.Count < 3 or WScript.Arguments.Count > 4 Then
        strDomain = WScript.Arguments.Item(0)
        strUser = WScript.Arguments.Item(1)
        strPassword = WScript.Arguments.Item(2)

        'set DNS IP address
        If WScript.Arguments.Count = 4 Then
        strDNSIP = WScript.Arguments.Item(3)
        Set objShell = CreateObject("WScript.shell")
        objShell.Run "netsh int ip set dns ""local area connection"" static "& _
        strDNSIP &" primary",0,0
        End If

        End If

        Set objNetwork = CreateObject("WScript.Network")
        strComputer = objNetwork.ComputerName

        Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
        strComputer & _
        "\root\cimv2:Win32_ComputerSystem.Name='" _
        & strComputer & "'")
        ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
        strPassword, _
        strDomain & "\" & strUser, _
        NULL, _
      • I can't use the same process like you as we can't reuse the same old name AND we don't have time to create the name before imaging.
This content is currently hidden from public view.
Reason: Removed by member request For more information, visit our FAQ's.
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ