[MicroWin] Add custom user settings and other changes (docs/bugfixes) (#2575)

* [MicroWin] Add custom user settings

* Update inputXML.xaml

* Update MicroWin documentation to reflect changes

* Update Invoke-WinUtilMicroWin-Helper.ps1

* Update Invoke-WPFMicrowin.ps1
This commit is contained in:
CodingWonders
2024-08-19 21:21:12 +02:00
committed by GitHub
parent 83fe6c5b12
commit 2748767a47
4 changed files with 92 additions and 28 deletions

View File

@ -247,6 +247,11 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
function New-Unattend {
param (
[Parameter(Mandatory, Position = 0)] [string] $userName,
[Parameter(Position = 1)] [string] $userPassword
)
$unattend = @'
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
@ -269,21 +274,21 @@ function New-Unattend {
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Name>User</Name>
<Name>USER-REPLACEME</Name>
<Group>Administrators</Group>
<Password>
<Value></Value>
<Value>PW-REPLACEME</Value>
<PlainText>true</PlainText>
</Password>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<AutoLogon>
<Username>User</Username>
<Username>USER-REPLACEME</Username>
<Enabled>true</Enabled>
<LogonCount>1</LogonCount>
<Password>
<Value></Value>
<Value>PW-REPLACEME</Value>
<PlainText>true</PlainText>
</Password>
</AutoLogon>
@ -543,6 +548,11 @@ function New-Unattend {
# Replace the placeholder text with the Specialize pass
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
}
# Replace default User and Password values with the provided parameters
$unattend = $unattend.Replace("USER-REPLACEME", $userName).Trim()
$unattend = $unattend.Replace("PW-REPLACEME", $userPassword).Trim()
# Save unattended answer file with UTF-8 encoding
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force -Encoding utf8
}