Skip to content

Instantly share code, notes, and snippets.

@MarcoGriep88
Created October 23, 2025 07:36
Show Gist options
  • Select an option

  • Save MarcoGriep88/4827dddf828207b58d5d4897f853ba3d to your computer and use it in GitHub Desktop.

Select an option

Save MarcoGriep88/4827dddf828207b58d5d4897f853ba3d to your computer and use it in GitHub Desktop.
$sourceXML = "https://gist.githubusercontent.com/MarcoGriep88/5d7f966d87e1ce4073978a731738a34b/raw/b799b8483c9287b2977dad8fb04257206b783295/gistfile1.txt"
$tempPath = "$($env:TEMP)\oobe"
if (-Not (Test-Path -Path $tempPath)) {
New-Item -ItemType Directory -Path $tempPath -Force -ErrorAction SilentlyContinue
}
$destitionPath = "$($env:TEMP)\oobe\deploy.xml"
Invoke-WebRequest -Uri $sourceXML -Method Get -OutFile $destitionPath -ErrorAction Stop
Write-Host "Successfully downloaded file $($destitionPath)"
Write-Host "Run Sysprep now? (Y/n):"
$answer = Read-Host
if ($answer -eq "Y" -or "" -or $null) {
Write-Host "Starting Sysprep..."
Start-Process -FilePath "C:\Windows\System32\Sysprep\sysprep.exe" `
-ArgumentList "/generalize", "/shutdown", "/oobe", "/unattend:$($env:TEMP)\oobe\deploy.xml" `
-Wait
Write-Host "Sysprep successfull"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment