change to easier naming scheme

- rename files
- rename function names
This commit is contained in:
MyDrift 2024-10-25 10:56:50 +02:00
parent 9d017ffdb7
commit 24a7d13e1b
17 changed files with 55 additions and 55 deletions

View File

@ -113,7 +113,7 @@
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>19</Order>
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Invoke-MicrowinRemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Microwin-RemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>20</Order>
@ -312,7 +312,7 @@ foreach( $file in $Document.unattend.Extensions.File ) {
[System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $file.InnerText.Trim() ) ) );
}
</ExtractScript>
<File path="C:\Windows\Temp\Invoke-MicrowinRemovePackages.ps1">
<File path="C:\Windows\Temp\Microwin-RemovePackages.ps1">
$selectors = @(
'Microsoft.Microsoft3DViewer';
'Microsoft.BingSearch';
@ -359,7 +359,7 @@ $removeCommand = {
}
};
$type = 'Package';
$logfile = 'C:\Windows\Temp\Invoke-MicrowinRemovePackages.log';
$logfile = 'C:\Windows\Temp\Microwin-RemovePackages.log';
&amp; {
$installed = &amp; $getCommand;
foreach( $selector in $selectors ) {

View File

@ -78,7 +78,7 @@ public class PowerManagement {
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
if ((Invoke-MicrowinTestCompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
Write-Host $msg
@ -88,7 +88,7 @@ public class PowerManagement {
}
# Detect whether the image to process contains Windows 10 and show warning
if ((Invoke-MicrowinTestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
$msg = "Windows 10 has been detected in the image you want to process. While you can continue, Windows 10 is not a recommended target for MicroWin, and you may not get the full experience."
$dlg_msg = $msg
Write-Host $msg
@ -155,12 +155,12 @@ public class PowerManagement {
}
Write-Host "Remove Features from the image"
Invoke-MicrowinRemoveFeatures
Microwin-RemoveFeatures
Write-Host "Removing features complete!"
Write-Host "Removing OS packages"
Invoke-MicrowinRemovePackages
Microwin-RemovePackages
Write-Host "Removing Appx Bloat"
Invoke-MicrowinRemoveProvisionedPackages
Microwin-RemoveProvisionedPackages
# Detect Windows 11 24H2 and add dependency to FileExp to prevent Explorer look from going back - thanks @WitherOrNot and @thecatontheceiling
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,26100,1))) -eq $true) {
@ -170,7 +170,7 @@ public class PowerManagement {
# 1. Take ownership of the file, from TrustedInstaller to Administrators
takeown /F "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /A
# 2. Set ACLs so that we can write to it
icacls "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /grant "$(Invoke-MicrowinGetLocalizedUsers -admins $true):(M)" | Out-Host
icacls "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /grant "$(Microwin-GetLocalizedUsers -admins $true):(M)" | Out-Host
# 3. Open the file and do the modification
$appxManifest = Get-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml"
$originalLine = $appxManifest[13]
@ -184,40 +184,40 @@ public class PowerManagement {
}
}
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Media Player" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Mail" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Mail" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Internet Explorer" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Internet Explorer" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\GameBarPresenceWriter"
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDriveSetup.exe"
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDrive.ico"
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
Invoke-MicrowinRemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Media Player" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Mail" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Mail" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Internet Explorer" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Internet Explorer" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\GameBarPresenceWriter"
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDriveSetup.exe"
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDrive.ico"
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
Write-Host "Removal complete!"
Write-Host "Create unattend.xml"
#Invoke-MicrowinNewUnattend
#Microwin-NewUnattend
if ($sync.MicrowinUserName.Text -eq "")
{
Invoke-MicrowinNewUnattend -userName "User"
Microwin-NewUnattend -userName "User"
}
else
{
if ($sync.MicrowinUserPassword.Password -eq "")
{
Invoke-MicrowinNewUnattend -userName "$($sync.MicrowinUserName.Text)"
Microwin-NewUnattend -userName "$($sync.MicrowinUserName.Text)"
}
else
{
Invoke-MicrowinNewUnattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
Microwin-NewUnattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
}
}
Write-Host "Done Create unattend.xml"
@ -230,7 +230,7 @@ public class PowerManagement {
Write-Host "Done Copy unattend.xml"
Write-Host "Create FirstRun"
Invoke-MicrowinNewFirstRun
Microwin-NewFirstRun
Write-Host "Done create FirstRun"
Write-Host "Copy FirstRun.ps1 into the ISO"
Copy-Item "$env:temp\FirstStartup.ps1" "$($scratchDir)\Windows\FirstStartup.ps1" -force
@ -242,7 +242,7 @@ public class PowerManagement {
dism /English /image:$($scratchDir) /set-profilepath:"$($scratchDir)\Windows\Users\Default"
Write-Host "Copy checkinstall.cmd into the ISO"
Invoke-MicrowinNewCheckInstall
Microwin-NewCheckInstall
Copy-Item "$env:temp\checkinstall.cmd" "$($scratchDir)\Windows\checkinstall.cmd" -force
Write-Host "Done copy checkinstall.cmd"
@ -318,7 +318,7 @@ public class PowerManagement {
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 0 /f
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 0 /f
if ((Invoke-MicrowinTestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
# We're dealing with Windows 10. Configure sane desktop settings. NOTE: even though stuff to disable News and Interests is there,
# it doesn't seem to work, and I don't want to waste more time dealing with an operating system that will lose support in a year (2025)
@ -430,7 +430,7 @@ public class PowerManagement {
if ($copyToUSB) {
Write-Host "Copying target ISO to the USB drive"
Invoke-MicrowinCopyToUSB("$($SaveDialog.FileName)")
Microwin-CopyToUSB("$($SaveDialog.FileName)")
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
}

View File

@ -50,7 +50,7 @@ function Invoke-MicrowinGetIso {
return
} else {
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it from github. This might take a long time.")
Invoke-MicrowinGetOscdimg -oscdimgPath $oscdimgPath
Microwin-GetOscdimg -oscdimgPath $oscdimgPath
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
if (!$oscdImgFound) {
$msg = "oscdimg was not downloaded can not proceed"
@ -100,7 +100,7 @@ function Invoke-MicrowinGetIso {
Set-Location -Path $env:temp
# Detect if the first option ("System language") has been selected and get a Fido-approved language from the current culture
$lang = if ($sync["ISOLanguage"].SelectedIndex -eq 0) {
Invoke-MicrowinGetLangFromCulture -langName (Get-Culture).Name
Microwin-GetLangFromCulture -langName (Get-Culture).Name
} else {
$sync["ISOLanguage"].SelectedItem
}

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinCopyToUSB([string]$fileToCopy) {
function Microwin-CopyToUSB([string]$fileToCopy) {
foreach ($volume in Get-Volume) {
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") {
$destinationPath = "$($volume.DriveLetter):\"

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinGetLangFromCulture {
function Microwin-GetLangFromCulture {
param (
[Parameter(Mandatory, Position = 0)] [string]$langName

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinGetLocalizedUsers
function Microwin-GetLocalizedUsers
{
<#
.SYNOPSIS
@ -8,7 +8,7 @@ function Invoke-MicrowinGetLocalizedUsers
.OUTPUTS
A string containing the localized user group
.EXAMPLE
Invoke-MicrowinGetLocalizedUsers -admins $true
Microwin-GetLocalizedUsers -admins $true
#>
param (
[Parameter(Mandatory = $true, Position = 0)] [bool]$admins

View File

@ -1,10 +1,10 @@
function Invoke-MicrowinGetOscdimg {
function Microwin-GetOscdimg {
<#
.DESCRIPTION
This function will download oscdimg file from github Release folders and put it into env:temp folder
.EXAMPLE
Invoke-MicrowinGetOscdimg
Microwin-GetOscdimg
#>
param(

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinNewCheckInstall {
function Microwin-NewCheckInstall {
# using here string to embedd firstrun
$checkInstall = @'

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinNewFirstRun {
function Microwin-NewFirstRun {
# using here string to embedd firstrun
$firstRun = @'

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinNewUnattend {
function Microwin-NewUnattend {
param (
[Parameter(Mandatory, Position = 0)] [string]$userName,
@ -160,7 +160,7 @@ function Invoke-MicrowinNewUnattend {
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>19</Order>
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Invoke-MicrowinRemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Microwin-RemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>20</Order>
@ -294,7 +294,7 @@ function Invoke-MicrowinNewUnattend {
</component>
</settings>
'@
if ((Invoke-MicrowinTestCompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
if ((Microwin-TestCompatibleImage $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()
} else {

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinRemoveFeatures() {
function Microwin-RemoveFeatures() {
<#
.SYNOPSIS
Removes certain features from ISO image
@ -7,7 +7,7 @@ function Invoke-MicrowinRemoveFeatures() {
No Params
.EXAMPLE
Invoke-MicrowinRemoveFeatures
Microwin-RemoveFeatures
#>
try {
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir)

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinRemoveFileOrDirectory([string]$pathToDelete, [string]$mask = "", [switch]$Directory = $false) {
function Microwin-RemoveFileOrDirectory([string]$pathToDelete, [string]$mask = "", [switch]$Directory = $false) {
if(([string]::IsNullOrEmpty($pathToDelete))) { return }
if (-not (Test-Path -Path "$($pathToDelete)")) { return }

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinRemovePackages {
function Microwin-RemovePackages {
try {
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinRemoveProvisionedPackages() {
function Microwin-RemoveProvisionedPackages() {
<#
.SYNOPSIS
Removes AppX packages from a Windows image during MicroWin processing
@ -7,7 +7,7 @@ function Invoke-MicrowinRemoveProvisionedPackages() {
No Params
.EXAMPLE
Invoke-MicrowinRemoveProvisionedPackages
Microwin-RemoveProvisionedPackages
#>
try
{

View File

@ -1,4 +1,4 @@
function Invoke-MicrowinTestCompatibleImage() {
function Microwin-TestCompatibleImage() {
<#
.SYNOPSIS
Checks the version of a Windows image and determines whether or not it is compatible with a specific feature depending on a desired version

View File

@ -413,7 +413,7 @@ $sync["ISOmanual"].add_Checked({
$sync["ISORelease"].Items.Add("24H2") | Out-Null
$sync["ISORelease"].SelectedItem = "24H2"
$sync["ISOLanguage"].Items.Add("System Language ($(Invoke-MicrowinGetLangFromCulture -langName $((Get-Culture).Name)))") | Out-Null
$sync["ISOLanguage"].Items.Add("System Language ($(Microwin-GetLangFromCulture -langName $((Get-Culture).Name)))") | Out-Null
if ($currentCulture -ne "English International") {
$sync["ISOLanguage"].Items.Add("English International") | Out-Null
}