Windows Server 2016 Core - Sysprep FirstLogonCommands RRS feed

  • Question

  • I am trying to setup a Windows 2016 CORE server image. I have a PowerShell script that I would like to run once after sysprep. This works fine for server w/GUI - but for some reason with server core it will not run.

                    <SynchronousCommand wcm:action="add">
                        <CommandLine>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden C:\Support\ServerConfigurationTool.ps1</CommandLine>

    Does anyone know if there is some caveat with core that prevents a run once command from running?  Or more specifically a Windows PowerShell script for the run once?  In my image, I have swapped the DOS prompt for the PS console as the default console that loads at login (not sure if that would matter, but just mentioning it just in case).



    Tuesday, June 27, 2017 7:45 PM


  • Looks like switching from cmd to PowerShell as the default shell breaks RunOnce, which I am guessing also breaks the sysprep FirstLogonCommands. There is a /runonce switch for the cmd shell that is not available, that I can tell, when using PowerShell.

    “/k runonce.exe /AleternateShellStartup”


    • Marked as answer by NJK-Work Wednesday, June 28, 2017 12:38 PM
    Wednesday, June 28, 2017 12:38 PM