Jump to content

How to determine when sysprep has finished executing FirstLogonCommands?

Recommended Posts


I'm trying to determine the best way to programmatically detect when sysprep has finished executing all SynchronousCommands in FirstLogonCommands from C:\Windows\Panther\unattend.xml.

I'd like to do this without having to do something special in unattend.xml, like write to a file as the last command and then if the file exists, then this determines sysprep has finished.

I'm wondering if the commands in unattend.xml are written to the registry (like HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce) and then the commands are actually run from the registry?

Or does sysprep parse the commands and runs them directly from unattend.xml?

What I currently have in mind is as follows:

1. Parse unattend.xml

2. For each SynchronousCommand parse the CommandLine to get the executable

3. Wait until all executables are not running.

I'm just wondering if there's a better way because this process is error-prone in at least two ways:

1. There may be a gap in-between the time subsequent SynchronousCommands are run.

2. This process will wait indefinitely if CommandLine contains a process which is the same as one that is run in the background as a service for example.

Thank you.

Link to comment
Share on other sites

Well, sysprep doesn't do any of this actually. What it does do is create the unattend.xml. If you specify one with /unattend switch or not, it will make one. If you look in the setupact.log file in UnattendGC, you will be able to see that msoobe.exe is what reads the XML and then runs the commands. Do a test deployment and then take a look at the log to see how things are being handled.

The key to remember is that sysprep only runs until the system is shut down. When you turn it back on again, or on first boot after redeploy, sysyprep does not run again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...