Scripting Sysprep

516 views Asked by At

I'm trying to create a script that will automate the sysprep process but I'm running into issues with the reg add command. I keep getting Invalid Syntax even though everything looks correct according to the reg add /? command.

Here's the script:

reg add HKLM\SYSTEM\Setup\Status\Sysprepstatus /v CleanupState /t REG_DWORD /d 00000002

reg add HKLM\SYSTEM\Setup\Status\Sysprepstatus /v GeneralizationState /t REG_DWORD /d 00000007

reg add HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform /v SkipRearm /t REG_DWORD /d 00000001

msdtc -uninstall

timeout 120

msdtc -install

timeout 120

"C:\Windows\System32\Sysprep.exe" /oobe /generalize /shutdown

Any help would be appreciated. Thanks in advance!

1

There are 1 answers

0
user4317867 On

The reg add command works for me, however cmd is running as an Administrator. That might be what's causing you problems.