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
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,22 @@ public class PowerManagement {
|
||||
Write-Host "Removal complete!"
|
||||
|
||||
Write-Host "Create unattend.xml"
|
||||
New-Unattend
|
||||
#New-Unattend
|
||||
if ($sync.MicrowinUserName.Text -eq "")
|
||||
{
|
||||
New-Unattend -userName "User"
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sync.MicrowinUserPassword.Password -eq "")
|
||||
{
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)"
|
||||
}
|
||||
else
|
||||
{
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
|
||||
}
|
||||
}
|
||||
Write-Host "Done Create unattend.xml"
|
||||
Write-Host "Copy unattend.xml file into the ISO"
|
||||
New-Item -ItemType Directory -Force -Path "$($scratchDir)\Windows\Panther"
|
||||
@ -248,7 +263,10 @@ public class PowerManagement {
|
||||
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
|
||||
|
||||
# When in Offline Image
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
if (Test-Path "HKLM:\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_")
|
||||
{
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
|
||||
|
Reference in New Issue
Block a user