diff --git a/OSDCloud/private/steps/4-install/step-install-expandwindowsimage.ps1 b/OSDCloud/private/steps/4-install/step-install-expandwindowsimage.ps1 index d830cb8..05d155e 100644 --- a/OSDCloud/private/steps/4-install/step-install-expandwindowsimage.ps1 +++ b/OSDCloud/private/steps/4-install/step-install-expandwindowsimage.ps1 @@ -52,16 +52,16 @@ function step-install-expandwindowsimage { try { Write-Verbose -Message "[$(Get-Date -format s)] [$($MyInvocation.MyCommand.Name)] Running Expand-WindowsImage with parameters: $($Params | Out-String)" Expand-WindowsImage @Params | Out-Null - New-Item -Path 'C:\Windows\Setup\Scripts' -ItemType Directory -Force | Out-Null + New-Item -Path 'C:\Windows\Setup\Scripts' -ItemType Directory -Force -ErrorAction Stop | Out-Null # Create SetupComplete.cmd if it does not exist $setupCompletePath = 'C:\Windows\Setup\Scripts\SetupComplete.cmd' if (-not (Test-Path $setupCompletePath)) { - New-Item -Path $setupCompletePath -ItemType File -Force | Out-Null + New-Item -Path $setupCompletePath -ItemType File -Force -ErrorAction Stop | Out-Null } # Create SetupComplete.cmd - ":: RecastOSDCloud $(Get-Date -format s)" | Out-File -FilePath $setupCompletePath -Append -Encoding ascii -Width 2000 -Force + ":: RecastOSDCloud $(Get-Date -format s)" | Out-File -FilePath $setupCompletePath -Append -Encoding ascii -Width 2000 -Force -ErrorAction Stop # Create OOBE.cmd - ":: RecastOSDCloud $(Get-Date -format s)" | Out-File -FilePath 'C:\Windows\Setup\Scripts\OOBE.cmd' -Append -Encoding ascii -Width 2000 -Force + ":: RecastOSDCloud $(Get-Date -format s)" | Out-File -FilePath 'C:\Windows\Setup\Scripts\OOBE.cmd' -Append -Encoding ascii -Width 2000 -Force -ErrorAction Stop } catch { Write-Warning "[$(Get-Date -format s)] Expand-WindowsImage failed."