Since many days I am trying to sysprep an azure virtual machine.
Following is the command that I am using to connect to the VM from local and executing the Upload-GoldImage.ps1 script
Invoke-Command -ConnectionUri $uri -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) -Credential $credential -ScriptBlock {C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -file "c:\program files\WindowsPowershell\Upload-GoldImage.ps1" -validateCurrentOS}
remote machine gets connected successfully. All the commands in the ps1 file are executed successfully but only the sysprep command isn't executing.
The ps1 mentioned above contains one command to sysprep the machine - Start-Process -FilePath C:\Windows\System32\Sysprep\sysprep.exe -ArgumentList '/generalize /oobe /shutdown /quiet'
Write-Host("After sysprep")
When this gets executed on my local powershell prompt - "After sysprep" is getting printed. I am getting no error in the sysprep command. Still the machine is not getting sysprepped.
Please if anyone could help me out
Thanks.