Is it fair to sysprep in shutdown mode through Packer?

Hi
Quick question right here :slight_smile:

I made a Windows Server 2022 gold image thanks to Packer and I use the following shutdown_command:

shutdown_command = "C:\\Windows\\system32\\sysprep\\sysprep.exe /unattend:E:\\sysprep.xml /quiet /generalize /oobe /shutdown"

(Note : i’m doing this for keeping network drivers while syspreping, else, Packer gets hung forever, more details here : https://github.com/hashicorp/packer/issues/4134#issuecomment-424492047 )
The sysprep.xml contains simple stuff mentioned in the link above.

My question is quite simple :
Does making the sysprep in shutdown mode is fair ?
i mean, if i clone this gold image, it will starts properly and ask for OOBE details (admin password etc…) but
does it means that all SIDs are re-generated ?

Thanks a lot !

Well, after reading a lot of documentation and testing, i’m able to say that it seems fair to do it that way.

Explanation:
According to this website https://thesolving.com/server-room/when-and-how-to-use-sysprep/ but also many others articles, i understood that sysprep “shutdown” mode clean up the current VM then once the VM will start again (or cloned) it will start on OOBE mode.

After trying some tests, I finally found out that SIDs are re-generated (you can check it with PsGetSid tool) in that way, so it’s pretty fair to use this method.

Can you send the full packer template.

I wasnt able to get packer to work doing this, in server 2025 it just does nothing. Packer goes into shutdown mode but the VM doesnt shutdown, infact sysprep doesnt even run.

Hi, no sorry there’s a lot of enterprise details i can’t share (and can’t take too much time to erase/replace them)

In my case it works, from Windows 2016-2025 included. However you need to have a proper sysprep.xml file, else nothing will happen.