Skip to content

Commit

Permalink
Microwin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Aug 19, 2024
1 parent 2748767 commit 23fef18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions functions/private/Invoke-WinUtilMicroWin-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function New-Unattend {

param (
[Parameter(Mandatory, Position = 0)] [string] $userName,
[Parameter(Position = 1)] [string] $userPassword
[Parameter(Position = 1)] [string] $userPassword = ""
)

$unattend = @'
Expand Down Expand Up @@ -543,14 +543,16 @@ function New-Unattend {
'@
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
# Replace the placeholder text with an empty string to make it valid for Windows 10 Setup
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
$unattend = $unattend.Replace("<#REPLACEME#>", "")
} else {
# Replace the placeholder text with the Specialize pass
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass)
}
# Replace default User and Password values with the provided parameters
$unattend = $unattend.Replace("USER-REPLACEME", $userName).Trim()
$unattend = $unattend.Replace("PW-REPLACEME", $userPassword).Trim()
$unattend = $unattend.Replace("USER-REPLACEME", $userName)
$unattend = $unattend.Replace("PW-REPLACEME", $userPassword)
# Trim the final string
$unattend = $unattend.Trim()

# Save unattended answer file with UTF-8 encoding
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force -Encoding utf8
Expand Down
2 changes: 1 addition & 1 deletion functions/public/Invoke-WPFGetIso.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function Invoke-WPFGetIso {
$mountDir = Join-Path $env:TEMP $randomMicrowin
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
} else {
$scratchDir = $sync.MicrowinScratchDirBox.Text+"Scrach"
$scratchDir = $sync.MicrowinScratchDirBox.Text+"Scratch"
$mountDir = $sync.MicrowinScratchDirBox.Text+"micro"
}

Expand Down
2 changes: 1 addition & 1 deletion functions/public/Invoke-WPFMicrowin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public class PowerManagement {
reg unload HKLM\zSYSTEM

Write-Host "Cleaning up image..."
dism /English /image:$scratchDir /Cleanup-Image /StartComponentCleanup /ResetBase
Start-Process -FilePath "dism" -ArgumentList "/English /image:$scratchDir /Cleanup-Image /StartComponentCleanup /ResetBase" -Wait
Write-Host "Cleanup complete."

Write-Host "Unmounting image..."
Expand Down

0 comments on commit 23fef18

Please sign in to comment.