I'm trying to build two post install tasks for a scripted install, one is to name the machine using wsname that reads from a data file.  And the second is a powershell script that adds the machine to the domain and joins to the appropriate OU.  I'm using the post install task converter with a reboot in between the two funcitons.  When I deploy the installation, the domain join function works perfectly, but the naming script is failing.  I've tested both functions on a local machine, and they both work.  When I check the wsname log, on the newly imaged machine I get an error that the machine is a member of a domain and to use the RCID switch. I have the naming function as the first post install task. Any ideas?

4 Comments   [ + ] Show Comments

Comments

  • Can you show the runonce converter script you are using?
  • @echo off

    IF /I "%~1" EQU "/DEBUG" (
    SET SWITCH=/debug
    ) else (
    set "SWITCH"=""
    )

    if %PROCESSOR_ARCHITECTURE% equ AMD64 (
    set "TAG=_x64"
    ) ELSE (
    set "TAG="
    )

    start /wait runonceex_converter%TAG%.exe %SWITCH%

    And here is the reboot script:

    taskkill /f /IM runonce.exe
    shutdown -f -r -t 1
    ping 127.0.0.1 -n 30
  • Here is my script. Also I had problems setting up my information in setting up to call the script. Here is my line for that to.
    Script

    @echo off

    IF /I "%~1" EQU "/DEBUG" (
    SET SWITCH=/debug
    ) else (
    set "SWITCH"=""
    )

    if %PROCESSOR_ARCHITECTURE% equ AMD64 (
    set "TAG=_x64"
    ) ELSE (
    set "TAG="
    )

    start /wait runonceex_converter%TAG%.exe %SWITCH%

    Command Line
    call runonceex_converter.bat



    I would be glad to help you if needed
  • Make sure when you build the script to include the bat and the two programs in a zip file. Once you have then zipped the command line is showing to call the converter. The problem I had when building this was the call. If you do not have that is caused a fail out for me multiple times.
Please log in to comment

Answers

1

Are you using the start /wait in front of your commands so they stay sequenced?

Answered 09/20/2013 by: SMal.tmcc
Red Belt

Please log in to comment
1

I would also try taking off the second postinstall and just see if the naming task completes on its own.

Answered 09/20/2013 by: nheyne
Red Belt

  • When I run the naming function on it's own, it works perfectly.
    • Your error above suggests that it's not happening in the correct order. Can you give more details about your wsname task?
      • I'm using the wsname task that I got from Kace, it consists of two scripts:

        xcopy /S /E /I source c:\source

        reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v V1 /t REG_SZ /d "CMD /C \"C:\source\1_wsname_x64.bat\"" /f

        shutdown -r -t 10

        Second Script:

        REM ***** Edit the DefailtUserName to that of the Administrator.
        REM ***** Change the "password" reference to the Administrators password.
        REM ***** Make sure the DefaultDomainNam is correct.



        REM reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
        REM reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d admin /f
        REM reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d password /f
        REM reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d localhost /f



        REM ***** Reference the Help files for WSNAME to see what options are available.
        REM ***** This command will make the name the SerialNumber of the computer *****
        REM ***** use nambedb.dat file with mac addresses and computer names to set computer name.
        REM ***** c:\source\wsname.exe /RDF:"C:\source\namedb.dat" /DFK:$MAC /EXCLUDEADAPTERS[WIRELESS WIFI WLAN BLUETOOTH PPP VMWARE IPSEC]



        start /wait c:\source\wsname.exe /RDF:C:\source\namedb.txt /DFK:$SERIALNUM
  • I think I may know what's going on. Your naming task is just a registry key that triggers a batch file, which is in RunOnce. The postinstall task converter uses RunOnceEx, which runs before anything in RunOnce. If your naming task was the actual batch file, it might work. But it's just the registry entry to trigger the batch file later. So the domain script will always run first with this setup.
Please log in to comment
Answer this question or Comment on this question for clarity