Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

fix: remove Azure agent specific artifacts from windows vhd #2088

Merged
merged 7 commits into from
Oct 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packer/windows-vhd-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@
"type": "powershell",
"inline": [
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /mode:vm /quiet /quit",
"Stop-Service WindowsAzureGuestAgent",
"Stop-Service WindowsAzureNetAgentSvc",
"Stop-Service RdAgent",
"Stop-Service WindowsAzureTelemetryService",
"& sc.exe delete WindowsAzureGuestAgent",
"& sc.exe delete WindowsAzureNetAgentSvc",
"& sc.exe delete RdAgent",
"& sc.exe delete WindowsAzureTelemetryService",
"Get-ChildItem c:\\WindowsAzure -Force | Sort-Object -Property FullName -Descending | ForEach-Object { try { Remove-Item -Path $_.FullName -Force -Recurse -ErrorAction SilentlyContinue; } catch { } }",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }",
"Remove-Item -Path WSMan:\\Localhost\\listener\\listener* -Recurse"
]
Expand Down