Merge pull request #6277 from dtzar/patch-1

Only show Windows Sysprep code with validation
This commit is contained in:
Christopher Boumenot 2018-07-02 16:15:21 -07:00 committed by GitHub
commit bf1b4b21a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 19 deletions

View File

@ -258,23 +258,7 @@ Please refer to the Azure [examples](https://github.com/hashicorp/packer/tree/ma
### Windows ### Windows
The following provisioner snippet shows how to sysprep a Windows VM. Deprovision should be the last operation executed by a build. The following provisioner snippet shows how to sysprep a Windows VM. Deprovision should be the last operation executed by a build. The code below will wait for sysprep to write the image status in the registry and will exit after that. The possible states, in case you want to wait for another state, [are documented here](https://technet.microsoft.com/en-us/library/hh824815.aspx)
``` json
{
"provisioners": [
{
"type": "powershell",
"inline": [
"if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}",
"& $Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /shutdown /quiet"
]
}
]
}
```
In some circumstances the above isn't enough to reliably know that the sysprep is actually finished generalizing the image, the code below will wait for sysprep to write the image status in the registry and will exit after that. The possible states, in case you want to wait for another state, [are documented here](https://technet.microsoft.com/en-us/library/hh824815.aspx)
``` json ``` json
{ {
@ -288,8 +272,6 @@ In some circumstances the above isn't enough to reliably know that the sysprep i
} }
] ]
} }
``` ```
### Linux ### Linux