mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 09:04:47 -05:00
[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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user