brommo
Visitor.
923 views

ZCM 17.3 WinPE Imaging Script

Hello,

I've created a WinPE preboot bundle which I'm deploying to devices. I have one problematic model which receives the error of "Error writing to archive" when it tried to restore an image. After cleaning the disk, re-creating the partition and formatting it via diskpart, the devices takes the image successfuly.

To try and automate this, I've setup my bundle by creating a WinPE Imaging Script, which runs diskpart to prepare the disk, then I have a Zenworks image in the bundle to restore using Zenworks WinPE Imaging.

The problem I'm having is that the imaging script part of the bundle loops and will not end and move onto the next part to restore the image.

Is there any way around this?

Cheers,
Vic
Labels (1)
0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

Re: ZCM 17.3 WinPE Imaging Script

Maybe add an explicit Exit Code of 0 to the script?

Note: That is a complete Flyer.....
0 Likes
brommo
Visitor.

Re: ZCM 17.3 WinPE Imaging Script

CRAIGDWILSON;2493192 wrote:
Maybe add an explicit Exit Code of 0 to the script?

Note: That is a complete Flyer.....



Thanks Craig. Perfect.

For anybody interested, this is what I ended up with as my WinPE Powershell imaging script.

New-Item X:\Windows\System32\diskpart.txt
Add-Content X:\Windows\System32\diskpart.txt "select disk 0"
Add-Content X:\Windows\System32\diskpart.txt "clean"
Add-Content X:\Windows\System32\diskpart.txt "create partition primary"
Add-Content X:\Windows\System32\diskpart.txt "assign letter = c"
Add-Content X:\Windows\System32\diskpart.txt "active"
Add-Content X:\Windows\System32\diskpart.txt "Format FS=NTFS LABEL=System QUICK"
Add-Content X:\Windows\System32\diskpart.txt "EXIT"

$InstallMSI = "diskpart.exe"
$MSIParams = "/s X:\Windows\System32\diskpart.txt"

Write-Host "Running diskpart..."
$process = [Diagnostics.Process]::Start($InstallMSI,$MSIParams)
$process.WaitForExit()

X:\Windows\System32\img.exe -rp win10-base-v1.zmg -ip="xxx.xxx.xxx.xxx" -set="1"

$LASTEXITCODE = 0
EXIT $LASTEXITCODE
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.