mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-17 10:17:44 -06:00
Remove All Trailing Whitespace Characters in '.ps1' Files
This commit is contained in:
parent
864f063878
commit
c8a448d465
@ -1,27 +1,27 @@
|
|||||||
function ConvertTo-Icon {
|
function ConvertTo-Icon {
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function will convert PNG to ICO file
|
This function will convert PNG to ICO file
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
|
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath $iconPath
|
||||||
#>
|
#>
|
||||||
param( [Parameter(Mandatory=$true)]
|
param( [Parameter(Mandatory=$true)]
|
||||||
$bitmapPath,
|
$bitmapPath,
|
||||||
$iconPath = "$env:temp\newicon.ico"
|
$iconPath = "$env:temp\newicon.ico"
|
||||||
)
|
)
|
||||||
|
|
||||||
Add-Type -AssemblyName System.Drawing
|
Add-Type -AssemblyName System.Drawing
|
||||||
|
|
||||||
if (Test-Path $bitmapPath) {
|
if (Test-Path $bitmapPath) {
|
||||||
$b = [System.Drawing.Bitmap]::FromFile($bitmapPath)
|
$b = [System.Drawing.Bitmap]::FromFile($bitmapPath)
|
||||||
$icon = [System.Drawing.Icon]::FromHandle($b.GetHicon())
|
$icon = [System.Drawing.Icon]::FromHandle($b.GetHicon())
|
||||||
$file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate')
|
$file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate')
|
||||||
$icon.Save($file)
|
$icon.Save($file)
|
||||||
$file.Close()
|
$file.Close()
|
||||||
$icon.Dispose()
|
$icon.Dispose()
|
||||||
#explorer "/SELECT,$iconpath"
|
#explorer "/SELECT,$iconpath"
|
||||||
}
|
}
|
||||||
else { Write-Warning "$BitmapPath does not exist" }
|
else { Write-Warning "$BitmapPath does not exist" }
|
||||||
}
|
}
|
@ -1,22 +1,22 @@
|
|||||||
function Copy-Files {
|
function Copy-Files {
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function will make all modifications to the registry
|
This function will make all modifications to the registry
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
|
|
||||||
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||||
|
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
[string] $Path,
|
[string] $Path,
|
||||||
[string] $Destination,
|
[string] $Destination,
|
||||||
[switch] $Recurse = $false,
|
[switch] $Recurse = $false,
|
||||||
[switch] $Force = $false
|
[switch] $Force = $false
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$files = Get-ChildItem -Path $path -Recurse:$recurse
|
$files = Get-ChildItem -Path $path -Recurse:$recurse
|
||||||
Write-Host "Copy $($files.Count)(s) from $path to $destination"
|
Write-Host "Copy $($files.Count)(s) from $path to $destination"
|
||||||
@ -35,9 +35,9 @@ function Copy-Files {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Debug "Copy from $($file.FullName) to $($destination+$restpath)"
|
Write-Debug "Copy from $($file.FullName) to $($destination+$restpath)"
|
||||||
Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force
|
Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force
|
||||||
Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false
|
Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
|
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
function Get-LocalizedYesNo {
|
function Get-LocalizedYesNo {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
This function runs choice.exe and captures its output to extract yes no in a localized Windows
|
This function runs choice.exe and captures its output to extract yes no in a localized Windows
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No
|
The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No
|
||||||
in the localized format, such as "Yes=<first character>, No=<second character>".
|
in the localized format, such as "Yes=<first character>, No=<second character>".
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$yesNoArray = Get-LocalizedYesNo
|
$yesNoArray = Get-LocalizedYesNo
|
||||||
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
|
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
# Run choice and capture its options as output
|
# Run choice and capture its options as output
|
||||||
# The output shows the options for Yes and No as "[Y,N]?" in the (partitially) localized format.
|
# The output shows the options for Yes and No as "[Y,N]?" in the (partitially) localized format.
|
||||||
# eg. English: [Y,N]?
|
# eg. English: [Y,N]?
|
||||||
@ -21,7 +21,7 @@ function Get-LocalizedYesNo {
|
|||||||
# Spanish: [S,N]?
|
# Spanish: [S,N]?
|
||||||
# Italian: [S,N]?
|
# Italian: [S,N]?
|
||||||
# Russian: [Y,N]?
|
# Russian: [Y,N]?
|
||||||
|
|
||||||
$line = cmd /c "choice <nul 2>nul"
|
$line = cmd /c "choice <nul 2>nul"
|
||||||
$charactersArray = @()
|
$charactersArray = @()
|
||||||
$regexPattern = '([a-zA-Z])'
|
$regexPattern = '([a-zA-Z])'
|
||||||
@ -31,51 +31,51 @@ function Get-LocalizedYesNo {
|
|||||||
# Return the array of characters
|
# Return the array of characters
|
||||||
return $charactersArray
|
return $charactersArray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Get-LocalizedYesNoTakeown {
|
function Get-LocalizedYesNoTakeown {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
This function runs takeown.exe and captures its output to extract yes no in a localized Windows
|
This function runs takeown.exe and captures its output to extract yes no in a localized Windows
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
The function retrieves lines from the output of takeown.exe until there are at least 2 characters
|
The function retrieves lines from the output of takeown.exe until there are at least 2 characters
|
||||||
captured in a specific format, such as "Yes=<first character>, No=<second character>".
|
captured in a specific format, such as "Yes=<first character>, No=<second character>".
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$yesNoArray = Get-LocalizedYesNo
|
$yesNoArray = Get-LocalizedYesNo
|
||||||
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
|
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
# Run takeown.exe and capture its output
|
# Run takeown.exe and capture its output
|
||||||
$takeownOutput = & takeown.exe /? | Out-String
|
$takeownOutput = & takeown.exe /? | Out-String
|
||||||
|
|
||||||
# Parse the output and retrieve lines until there are at least 2 characters in the array
|
# Parse the output and retrieve lines until there are at least 2 characters in the array
|
||||||
$found = $false
|
$found = $false
|
||||||
$charactersArray = @()
|
$charactersArray = @()
|
||||||
foreach ($line in $takeownOutput -split "`r`n")
|
foreach ($line in $takeownOutput -split "`r`n")
|
||||||
{
|
{
|
||||||
# skip everything before /D flag help
|
# skip everything before /D flag help
|
||||||
if ($found)
|
if ($found)
|
||||||
{
|
{
|
||||||
# now that /D is found start looking for a single character in double quotes
|
# now that /D is found start looking for a single character in double quotes
|
||||||
# in help text there is another string in double quotes but it is not a single character
|
# in help text there is another string in double quotes but it is not a single character
|
||||||
$regexPattern = '"([a-zA-Z])"'
|
$regexPattern = '"([a-zA-Z])"'
|
||||||
|
|
||||||
$charactersArray = [regex]::Matches($line, $regexPattern) | ForEach-Object { $_.Groups[1].Value }
|
$charactersArray = [regex]::Matches($line, $regexPattern) | ForEach-Object { $_.Groups[1].Value }
|
||||||
|
|
||||||
# if ($charactersArray.Count -gt 0) {
|
# if ($charactersArray.Count -gt 0) {
|
||||||
# Write-Output "Extracted symbols: $($matches -join ', ')"
|
# Write-Output "Extracted symbols: $($matches -join ', ')"
|
||||||
# } else {
|
# } else {
|
||||||
# Write-Output "No matches found."
|
# Write-Output "No matches found."
|
||||||
# }
|
# }
|
||||||
|
|
||||||
if ($charactersArray.Count -ge 2)
|
if ($charactersArray.Count -ge 2)
|
||||||
{
|
{
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($line -match "/D ")
|
elseif ($line -match "/D ")
|
||||||
{
|
{
|
||||||
$found = $true
|
$found = $true
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
function Get-Oscdimg {
|
function Get-Oscdimg {
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function will download oscdimg file from github Release folders and put it into env:temp folder
|
This function will download oscdimg file from github Release folders and put it into env:temp folder
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Oscdimg
|
Get-Oscdimg
|
||||||
#>
|
#>
|
||||||
param( [Parameter(Mandatory=$true)]
|
param( [Parameter(Mandatory=$true)]
|
||||||
[string]$oscdimgPath
|
[string]$oscdimgPath
|
||||||
)
|
)
|
||||||
$oscdimgPath = "$env:TEMP\oscdimg.exe"
|
$oscdimgPath = "$env:TEMP\oscdimg.exe"
|
||||||
@ -24,4 +24,4 @@ function Get-Oscdimg {
|
|||||||
} else {
|
} else {
|
||||||
Write-Host "Hashes do not match. File may be corrupted or tampered with."
|
Write-Host "Hashes do not match. File may be corrupted or tampered with."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ function Get-TabXaml {
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-TabXaml "applications" 3
|
Get-TabXaml "applications" 3
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
||||||
param( [Parameter(Mandatory=$true)]
|
param( [Parameter(Mandatory=$true)]
|
||||||
$tabname,
|
$tabname,
|
||||||
$columncount = 0
|
$columncount = 0
|
||||||
@ -80,7 +80,7 @@ function Get-TabXaml {
|
|||||||
|
|
||||||
# Dot-source the Get-WPFObjectName function
|
# Dot-source the Get-WPFObjectName function
|
||||||
. .\functions\private\Get-WPFObjectName
|
. .\functions\private\Get-WPFObjectName
|
||||||
|
|
||||||
$categorycontent = $($category -replace '^.__', '')
|
$categorycontent = $($category -replace '^.__', '')
|
||||||
$categoryname = Get-WPFObjectName -type "Label" -name $categorycontent
|
$categoryname = Get-WPFObjectName -type "Label" -name $categorycontent
|
||||||
$blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`n"
|
$blockXml += "<Label Name=""$categoryname"" Content=""$categorycontent"" FontSize=""16""/>`n"
|
||||||
|
@ -10,17 +10,17 @@ function Get-WPFObjectName {
|
|||||||
.OUTPUTS
|
.OUTPUTS
|
||||||
A string that can be used as a object/variable name in powershell.
|
A string that can be used as a object/variable name in powershell.
|
||||||
For example: WPFLabelMicrosoftTools
|
For example: WPFLabelMicrosoftTools
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-WPFObjectName -type Label -name "Microsoft Tools"
|
Get-WPFObjectName -type Label -name "Microsoft Tools"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param( [Parameter(Mandatory=$true)]
|
param( [Parameter(Mandatory=$true)]
|
||||||
$type,
|
$type,
|
||||||
$name
|
$name
|
||||||
)
|
)
|
||||||
|
|
||||||
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', ''
|
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', ''
|
||||||
|
|
||||||
return $Output
|
return $Output
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
else{
|
else{
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleShowExt"){
|
if($ToggleSwitch -eq "WPFToggleShowExt"){
|
||||||
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
||||||
if($hideextvalue -eq 0){
|
if($hideextvalue -eq 0){
|
||||||
@ -58,7 +58,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
else{
|
else{
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleSnapWindow"){
|
if($ToggleSwitch -eq "WPFToggleSnapWindow"){
|
||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||||
if($hidesnap -eq 0){
|
if($hidesnap -eq 0){
|
||||||
@ -76,7 +76,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
else{
|
else{
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleSnapSuggestion"){
|
if($ToggleSwitch -eq "WPFToggleSnapSuggestion"){
|
||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||||
if($hidesnap -eq 0){
|
if($hidesnap -eq 0){
|
||||||
@ -85,7 +85,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
else{
|
else{
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){
|
if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){
|
||||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||||
|
@ -5,8 +5,8 @@ function Get-WinUtilWingetLatest {
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
||||||
#>
|
#>
|
||||||
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
||||||
$PreviousProgressPreference = $ProgressPreference
|
$PreviousProgressPreference = $ProgressPreference
|
||||||
$ProgressPreference = "silentlyContinue"
|
$ProgressPreference = "silentlyContinue"
|
||||||
Try{
|
Try{
|
||||||
# Grabs the latest release of Winget from the Github API for the install process.
|
# Grabs the latest release of Winget from the Github API for the install process.
|
||||||
|
@ -2,17 +2,17 @@ function Install-WinUtilProgramChoco {
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Manages the provided programs using Chocolatey
|
Manages the provided programs using Chocolatey
|
||||||
|
|
||||||
.PARAMETER ProgramsToInstall
|
.PARAMETER ProgramsToInstall
|
||||||
A list of programs to manage
|
A list of programs to manage
|
||||||
|
|
||||||
.PARAMETER manage
|
.PARAMETER manage
|
||||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
The triple quotes are required any time you need a " in a normal script block.
|
The triple quotes are required any time you need a " in a normal script block.
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory, Position=0)]
|
[Parameter(Mandatory, Position=0)]
|
||||||
[PsCustomObject]$ProgramsToInstall,
|
[PsCustomObject]$ProgramsToInstall,
|
||||||
@ -20,7 +20,7 @@ function Install-WinUtilProgramChoco {
|
|||||||
[Parameter(Position=1)]
|
[Parameter(Position=1)]
|
||||||
[String]$manage = "Installing"
|
[String]$manage = "Installing"
|
||||||
)
|
)
|
||||||
|
|
||||||
$x = 0
|
$x = 0
|
||||||
$count = $ProgramsToInstall.Count
|
$count = $ProgramsToInstall.Count
|
||||||
|
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
Function Install-WinUtilProgramWinget {
|
Function Install-WinUtilProgramWinget {
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Manages the provided programs using Winget
|
Manages the provided programs using Winget
|
||||||
|
|
||||||
.PARAMETER ProgramsToInstall
|
.PARAMETER ProgramsToInstall
|
||||||
A list of programs to manage
|
A list of programs to manage
|
||||||
|
|
||||||
.PARAMETER manage
|
.PARAMETER manage
|
||||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
The triple quotes are required any time you need a " in a normal script block.
|
The triple quotes are required any time you need a " in a normal script block.
|
||||||
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
|
The winget Return codes are documented here: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory, Position=0)]
|
[Parameter(Mandatory, Position=0)]
|
||||||
[PsCustomObject]$ProgramsToInstall,
|
[PsCustomObject]$ProgramsToInstall,
|
||||||
|
|
||||||
[Parameter(Position=1)]
|
[Parameter(Position=1)]
|
||||||
[String]$manage = "Installing"
|
[String]$manage = "Installing"
|
||||||
)
|
)
|
||||||
$x = 0
|
$x = 0
|
||||||
$count = $ProgramsToInstall.Count
|
$count = $ProgramsToInstall.Count
|
||||||
|
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "-- Configuring winget packages ---"
|
Write-Host "-- Configuring winget packages ---"
|
||||||
@ -33,7 +33,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
$failedPackages = @()
|
$failedPackages = @()
|
||||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||||
if($manage -eq "Installing"){
|
if($manage -eq "Installing"){
|
||||||
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
||||||
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
||||||
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
||||||
# This is up to the individual package maintainers to enable these options. Aka. not as clean as Linux Package Managers.
|
# This is up to the individual package maintainers to enable these options. Aka. not as clean as Linux Package Managers.
|
||||||
|
@ -41,7 +41,7 @@ function Install-WinUtilWinget {
|
|||||||
Write-Host "Installing Winget w/ Prerequsites`r"
|
Write-Host "Installing Winget w/ Prerequsites`r"
|
||||||
Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml
|
Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml
|
||||||
Write-Host "Manually adding Winget Sources, from Winget CDN."
|
Write-Host "Manually adding Winget Sources, from Winget CDN."
|
||||||
Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time.
|
Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time.
|
||||||
Write-Host "Winget Installed" -ForegroundColor Green
|
Write-Host "Winget Installed" -ForegroundColor Green
|
||||||
Write-Host "Enabling NuGet and Module..."
|
Write-Host "Enabling NuGet and Module..."
|
||||||
Install-PackageProvider -Name NuGet -Force
|
Install-PackageProvider -Name NuGet -Force
|
||||||
|
@ -121,8 +121,8 @@ function Remove-Packages
|
|||||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||||
$_ -NotLike "*WMIC*" -AND
|
$_ -NotLike "*WMIC*" -AND
|
||||||
$_ -NotLike "*UI.XaML*"
|
$_ -NotLike "*UI.XaML*"
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($pkg in $pkglist)
|
foreach ($pkg in $pkglist)
|
||||||
{
|
{
|
||||||
@ -164,9 +164,9 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
|
|||||||
$_.PackageName -NotLike "*Notepad*" -and
|
$_.PackageName -NotLike "*Notepad*" -and
|
||||||
$_.PackageName -NotLike "*Printing*" -and
|
$_.PackageName -NotLike "*Printing*" -and
|
||||||
$_.PackageName -NotLike "*Wifi*" -and
|
$_.PackageName -NotLike "*Wifi*" -and
|
||||||
$_.PackageName -NotLike "*Foundation*"
|
$_.PackageName -NotLike "*Foundation*"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($?)
|
if ($?)
|
||||||
{
|
{
|
||||||
if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }}
|
if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.PackageName -NotLike "*SecHealthUI*" }}
|
||||||
@ -227,13 +227,13 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
|
|||||||
# Remove-Item -Path $directoryPath -Recurse -Force
|
# Remove-Item -Path $directoryPath -Recurse -Force
|
||||||
|
|
||||||
# # Grant full control to BUILTIN\Administrators using icacls
|
# # Grant full control to BUILTIN\Administrators using icacls
|
||||||
# $directoryPath = "$($scratchDir)\Windows\System32\WebThreatDefSvc"
|
# $directoryPath = "$($scratchDir)\Windows\System32\WebThreatDefSvc"
|
||||||
# takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
|
# takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
|
||||||
# icacls "$($directoryPath)" /q /c /t /reset > $null
|
# icacls "$($directoryPath)" /q /c /t /reset > $null
|
||||||
# icacls $directoryPath /setowner "*S-1-5-32-544"
|
# icacls $directoryPath /setowner "*S-1-5-32-544"
|
||||||
# icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
# icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||||
# Remove-Item -Path $directoryPath -Recurse -Force
|
# Remove-Item -Path $directoryPath -Recurse -Force
|
||||||
|
|
||||||
$itemsToDelete = [System.Collections.ArrayList]::new()
|
$itemsToDelete = [System.Collections.ArrayList]::new()
|
||||||
|
|
||||||
if ($mask -eq "")
|
if ($mask -eq "")
|
||||||
@ -241,9 +241,9 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
|
|||||||
Write-Debug "Adding $($pathToDelete) to array."
|
Write-Debug "Adding $($pathToDelete) to array."
|
||||||
[void]$itemsToDelete.Add($pathToDelete)
|
[void]$itemsToDelete.Add($pathToDelete)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
||||||
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory }
|
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory }
|
||||||
else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
|
|||||||
$status = "Deleting $($itemToDelete)"
|
$status = "Deleting $($itemToDelete)"
|
||||||
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
||||||
|
|
||||||
if (Test-Path -Path "$($itemToDelete)" -PathType Container)
|
if (Test-Path -Path "$($itemToDelete)" -PathType Container)
|
||||||
{
|
{
|
||||||
$status = "Deleting directory: $($itemToDelete)"
|
$status = "Deleting directory: $($itemToDelete)"
|
||||||
|
|
||||||
@ -473,16 +473,16 @@ function New-FirstRun {
|
|||||||
param (
|
param (
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$RegistryPath,
|
[string]$RegistryPath,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$ValueName
|
[string]$ValueName
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check if the registry path exists
|
# Check if the registry path exists
|
||||||
if (Test-Path -Path $RegistryPath)
|
if (Test-Path -Path $RegistryPath)
|
||||||
{
|
{
|
||||||
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
# Check if the registry value exists
|
# Check if the registry value exists
|
||||||
if ($registryValue)
|
if ($registryValue)
|
||||||
{
|
{
|
||||||
@ -500,7 +500,7 @@ function New-FirstRun {
|
|||||||
Write-Host "Registry path '$RegistryPath' not found."
|
Write-Host "Registry path '$RegistryPath' not found."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Stop-UnnecessaryServices
|
function Stop-UnnecessaryServices
|
||||||
{
|
{
|
||||||
$servicesToExclude = @(
|
$servicesToExclude = @(
|
||||||
@ -566,8 +566,8 @@ function New-FirstRun {
|
|||||||
"vm3dservice",
|
"vm3dservice",
|
||||||
"webthreatdefusersvc_dc2a4",
|
"webthreatdefusersvc_dc2a4",
|
||||||
"wscsvc"
|
"wscsvc"
|
||||||
)
|
)
|
||||||
|
|
||||||
$runningServices = Get-Service | Where-Object { $servicesToExclude -notcontains $_.Name }
|
$runningServices = Get-Service | Where-Object { $servicesToExclude -notcontains $_.Name }
|
||||||
foreach($service in $runningServices)
|
foreach($service in $runningServices)
|
||||||
{
|
{
|
||||||
@ -576,28 +576,28 @@ function New-FirstRun {
|
|||||||
"Stopping service $($service.Name)" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
"Stopping service $($service.Name)" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
||||||
|
|
||||||
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||||
Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value 1
|
Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value 1
|
||||||
Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value 1
|
Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value 1
|
||||||
|
|
||||||
# figure this out later how to set updates to security only
|
# figure this out later how to set updates to security only
|
||||||
#Import-Module -Name PSWindowsUpdate;
|
#Import-Module -Name PSWindowsUpdate;
|
||||||
#Stop-Service -Name wuauserv
|
#Stop-Service -Name wuauserv
|
||||||
#Set-WUSettings -MicrosoftUpdateEnabled -AutoUpdateOption 'Never'
|
#Set-WUSettings -MicrosoftUpdateEnabled -AutoUpdateOption 'Never'
|
||||||
#Start-Service -Name wuauserv
|
#Start-Service -Name wuauserv
|
||||||
|
|
||||||
Stop-UnnecessaryServices
|
Stop-UnnecessaryServices
|
||||||
|
|
||||||
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||||
# Delete all files on the Taskbar
|
# Delete all files on the Taskbar
|
||||||
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
||||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
||||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
||||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
||||||
|
|
||||||
# Stop-Process -Name explorer -Force
|
# Stop-Process -Name explorer -Force
|
||||||
|
|
||||||
$process = Get-Process -Name "explorer"
|
$process = Get-Process -Name "explorer"
|
||||||
@ -609,9 +609,9 @@ function New-FirstRun {
|
|||||||
# Delete Edge Icon from the desktop
|
# Delete Edge Icon from the desktop
|
||||||
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
||||||
# Check if Edge shortcuts exist on the desktop
|
# Check if Edge shortcuts exist on the desktop
|
||||||
if ($edgeShortcutFiles)
|
if ($edgeShortcutFiles)
|
||||||
{
|
{
|
||||||
foreach ($shortcutFile in $edgeShortcutFiles)
|
foreach ($shortcutFile in $edgeShortcutFiles)
|
||||||
{
|
{
|
||||||
# Remove each Edge shortcut
|
# Remove each Edge shortcut
|
||||||
Remove-Item -Path $shortcutFile.FullName -Force
|
Remove-Item -Path $shortcutFile.FullName -Force
|
||||||
@ -631,7 +631,7 @@ function New-FirstRun {
|
|||||||
$shortcutPath = Join-Path $desktopPath 'winutil.lnk'
|
$shortcutPath = Join-Path $desktopPath 'winutil.lnk'
|
||||||
# Create a shell object
|
# Create a shell object
|
||||||
$shell = New-Object -ComObject WScript.Shell
|
$shell = New-Object -ComObject WScript.Shell
|
||||||
|
|
||||||
# Create a shortcut object
|
# Create a shortcut object
|
||||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||||
|
|
||||||
@ -639,26 +639,26 @@ function New-FirstRun {
|
|||||||
{
|
{
|
||||||
$shortcut.IconLocation = "c:\Windows\cttlogo.png"
|
$shortcut.IconLocation = "c:\Windows\cttlogo.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set properties of the shortcut
|
# Set properties of the shortcut
|
||||||
$shortcut.TargetPath = "powershell.exe"
|
$shortcut.TargetPath = "powershell.exe"
|
||||||
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
||||||
# Save the shortcut
|
# Save the shortcut
|
||||||
$shortcut.Save()
|
$shortcut.Save()
|
||||||
|
|
||||||
# Make the shortcut have 'Run as administrator' property on
|
# Make the shortcut have 'Run as administrator' property on
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($shortcutPath)
|
$bytes = [System.IO.File]::ReadAllBytes($shortcutPath)
|
||||||
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
|
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
|
||||||
$bytes[0x15] = $bytes[0x15] -bor 0x20
|
$bytes[0x15] = $bytes[0x15] -bor 0x20
|
||||||
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
|
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
|
||||||
|
|
||||||
Write-Host "Shortcut created at: $shortcutPath"
|
Write-Host "Shortcut created at: $shortcutPath"
|
||||||
#
|
#
|
||||||
# Done create WinUtil shortcut on the desktop
|
# Done create WinUtil shortcut on the desktop
|
||||||
# ************************************************
|
# ************************************************
|
||||||
|
|
||||||
Start-Process explorer
|
Start-Process explorer
|
||||||
|
|
||||||
'@
|
'@
|
||||||
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
function Invoke-WinUtilGPU {
|
function Invoke-WinUtilGPU {
|
||||||
$gpuInfo = Get-CimInstance Win32_VideoController
|
$gpuInfo = Get-CimInstance Win32_VideoController
|
||||||
|
|
||||||
foreach ($gpu in $gpuInfo) {
|
foreach ($gpu in $gpuInfo) {
|
||||||
$gpuName = $gpu.Name
|
$gpuName = $gpu.Name
|
||||||
if ($gpuName -like "*NVIDIA*") {
|
if ($gpuName -like "*NVIDIA*") {
|
||||||
@ -11,19 +11,19 @@ function Invoke-WinUtilGPU {
|
|||||||
foreach ($gpu in $gpuInfo) {
|
foreach ($gpu in $gpuInfo) {
|
||||||
$gpuName = $gpu.Name
|
$gpuName = $gpu.Name
|
||||||
if ($gpuName -like "*AMD Radeon RX*") {
|
if ($gpuName -like "*AMD Radeon RX*") {
|
||||||
return $true # AMD GPU Found
|
return $true # AMD GPU Found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($gpu in $gpuInfo) {
|
foreach ($gpu in $gpuInfo) {
|
||||||
$gpuName = $gpu.Name
|
$gpuName = $gpu.Name
|
||||||
if ($gpuName -like "*UHD*") {
|
if ($gpuName -like "*UHD*") {
|
||||||
return $false # Intel Intergrated GPU Found
|
return $false # Intel Intergrated GPU Found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($gpu in $gpuInfo) {
|
foreach ($gpu in $gpuInfo) {
|
||||||
$gpuName = $gpu.Name
|
$gpuName = $gpu.Name
|
||||||
if ($gpuName -like "*AMD Radeon(TM)*") {
|
if ($gpuName -like "*AMD Radeon(TM)*") {
|
||||||
return $false # AMD Intergrated GPU Found
|
return $false # AMD Intergrated GPU Found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,13 +15,13 @@ Function Invoke-WinUtilMouseAcceleration {
|
|||||||
$MouseSpeed = 1
|
$MouseSpeed = 1
|
||||||
$MouseThreshold1 = 6
|
$MouseThreshold1 = 6
|
||||||
$MouseThreshold2 = 10
|
$MouseThreshold2 = 10
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "Disabling Mouse Acceleration"
|
Write-Host "Disabling Mouse Acceleration"
|
||||||
$MouseSpeed = 0
|
$MouseSpeed = 0
|
||||||
$MouseThreshold1 = 0
|
$MouseThreshold1 = 0
|
||||||
$MouseThreshold2 = 0
|
$MouseThreshold2 = 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$Path = "HKCU:\Control Panel\Mouse"
|
$Path = "HKCU:\Control Panel\Mouse"
|
||||||
|
@ -6,7 +6,7 @@ Function Invoke-WinUtilStickyKeys {
|
|||||||
Indicates whether to enable or disable Sticky Keys on startup
|
Indicates whether to enable or disable Sticky Keys on startup
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try {
|
Try {
|
||||||
if ($Enabled -eq $false){
|
if ($Enabled -eq $false){
|
||||||
Write-Host "Enabling Sticky Keys On startup"
|
Write-Host "Enabling Sticky Keys On startup"
|
||||||
$value = 510
|
$value = 510
|
||||||
|
@ -50,7 +50,7 @@ function Invoke-WinUtilTweaks {
|
|||||||
Write-Debug "KeepServiceStartup is $KeepServiceStartup"
|
Write-Debug "KeepServiceStartup is $KeepServiceStartup"
|
||||||
$sync.configs.tweaks.$CheckBox.service | ForEach-Object {
|
$sync.configs.tweaks.$CheckBox.service | ForEach-Object {
|
||||||
$changeservice = $true
|
$changeservice = $true
|
||||||
|
|
||||||
# The check for !($undo) is required, without it the script will throw an error for accessing unavailable memeber, which's the 'OriginalService' Property
|
# The check for !($undo) is required, without it the script will throw an error for accessing unavailable memeber, which's the 'OriginalService' Property
|
||||||
if($KeepServiceStartup -AND !($undo)) {
|
if($KeepServiceStartup -AND !($undo)) {
|
||||||
try {
|
try {
|
||||||
|
@ -2,10 +2,10 @@ function Show-CustomDialog {
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Displays a custom dialog box with an image, heading, message, and an OK button.
|
Displays a custom dialog box with an image, heading, message, and an OK button.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function creates a custom dialog box with the specified message and additional elements such as an image, heading, and an OK button. The dialog box is designed with a green border, rounded corners, and a black background.
|
This function creates a custom dialog box with the specified message and additional elements such as an image, heading, and an OK button. The dialog box is designed with a green border, rounded corners, and a black background.
|
||||||
|
|
||||||
.PARAMETER Message
|
.PARAMETER Message
|
||||||
The message to be displayed in the dialog box.
|
The message to be displayed in the dialog box.
|
||||||
|
|
||||||
@ -14,10 +14,10 @@ function Show-CustomDialog {
|
|||||||
|
|
||||||
.PARAMETER Height
|
.PARAMETER Height
|
||||||
The height of the custom dialog window.
|
The height of the custom dialog window.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
|
Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
|
||||||
|
|
||||||
#>
|
#>
|
||||||
param(
|
param(
|
||||||
[string]$Message,
|
[string]$Message,
|
||||||
@ -99,7 +99,7 @@ function Show-CustomDialog {
|
|||||||
$grid.RowDefinitions.Add($row0)
|
$grid.RowDefinitions.Add($row0)
|
||||||
$grid.RowDefinitions.Add($row1)
|
$grid.RowDefinitions.Add($row1)
|
||||||
$grid.RowDefinitions.Add($row2)
|
$grid.RowDefinitions.Add($row2)
|
||||||
|
|
||||||
# Add StackPanel for horizontal layout with margins
|
# Add StackPanel for horizontal layout with margins
|
||||||
$stackPanel = New-Object Windows.Controls.StackPanel
|
$stackPanel = New-Object Windows.Controls.StackPanel
|
||||||
$stackPanel.Margin = New-Object Windows.Thickness(10) # Add margins around the stack panel
|
$stackPanel.Margin = New-Object Windows.Thickness(10) # Add margins around the stack panel
|
||||||
@ -113,7 +113,7 @@ function Show-CustomDialog {
|
|||||||
$viewbox = New-Object Windows.Controls.Viewbox
|
$viewbox = New-Object Windows.Controls.Viewbox
|
||||||
$viewbox.Width = 25
|
$viewbox.Width = 25
|
||||||
$viewbox.Height = 25
|
$viewbox.Height = 25
|
||||||
|
|
||||||
# Combine the paths into a single string
|
# Combine the paths into a single string
|
||||||
# $cttLogoPath = @"
|
# $cttLogoPath = @"
|
||||||
# M174 1094 c-4 -14 -4 -55 -2 -92 3 -57 9 -75 41 -122 41 -60 45 -75 22 -84 -25 -9 -17 -21 30 -44 l45 -22 0 -103 c0 -91 3 -109 26 -155 30 -60 65 -87 204 -157 l95 -48 110 58 c184 96 205 127 205 293 l0 108 45 22 c47 23 55 36 30 46 -22 8 -18 30 9 63 13 16 34 48 46 71 20 37 21 52 15 116 l-6 73 -69 -23 c-38 -12 -137 -59 -220 -103 -82 -45 -160 -81 -171 -81 -12 0 -47 15 -78 34 -85 51 -239 127 -309 151 l-62 22 -6 -23z m500 -689 c20 -8 36 -19 36 -24 0 -18 -53 -51 -80 -51 -28 0 -80 33 -80 51 0 10 55 38 76 39 6 0 28 -7 48 -15z
|
# M174 1094 c-4 -14 -4 -55 -2 -92 3 -57 9 -75 41 -122 41 -60 45 -75 22 -84 -25 -9 -17 -21 30 -44 l45 -22 0 -103 c0 -91 3 -109 26 -155 30 -60 65 -87 204 -157 l95 -48 110 58 c184 96 205 127 205 293 l0 108 45 22 c47 23 55 36 30 46 -22 8 -18 30 9 63 13 16 34 48 46 71 20 37 21 52 15 116 l-6 73 -69 -23 c-38 -12 -137 -59 -220 -103 -82 -45 -160 -81 -171 -81 -12 0 -47 15 -78 34 -85 51 -239 127 -309 151 l-62 22 -6 -23z m500 -689 c20 -8 36 -19 36 -24 0 -18 -53 -51 -80 -51 -28 0 -80 33 -80 51 0 10 55 38 76 39 6 0 28 -7 48 -15z
|
||||||
@ -159,7 +159,7 @@ $cttLogoPath = @"
|
|||||||
46.21,102.83 36.63,98.57 31.04,93.68
|
46.21,102.83 36.63,98.57 31.04,93.68
|
||||||
16.88,81.28 19.00,62.88 19.00,46.00 Z
|
16.88,81.28 19.00,62.88 19.00,46.00 Z
|
||||||
"@
|
"@
|
||||||
|
|
||||||
# Add SVG path
|
# Add SVG path
|
||||||
$svgPath = New-Object Windows.Shapes.Path
|
$svgPath = New-Object Windows.Shapes.Path
|
||||||
$svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath)
|
$svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath)
|
||||||
@ -167,7 +167,7 @@ $cttLogoPath = @"
|
|||||||
|
|
||||||
# Add SVG path to Viewbox
|
# Add SVG path to Viewbox
|
||||||
$viewbox.Child = $svgPath
|
$viewbox.Child = $svgPath
|
||||||
|
|
||||||
# Add SVG path to the stack panel
|
# Add SVG path to the stack panel
|
||||||
$stackPanel.Children.Add($viewbox)
|
$stackPanel.Children.Add($viewbox)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ function Test-WinUtilPackageManager {
|
|||||||
Write-Host " - Winget is Out of Date" -ForegroundColor Red
|
Write-Host " - Winget is Out of Date" -ForegroundColor Red
|
||||||
$status = "outdated"
|
$status = "outdated"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "===========================================" -ForegroundColor Red
|
Write-Host "===========================================" -ForegroundColor Red
|
||||||
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
|
Write-Host "--- Winget is not installed ---" -ForegroundColor Red
|
||||||
Write-Host "===========================================" -ForegroundColor Red
|
Write-Host "===========================================" -ForegroundColor Red
|
||||||
|
@ -8,13 +8,13 @@ function Invoke-ScratchDialog {
|
|||||||
|
|
||||||
.PARAMETER Button
|
.PARAMETER Button
|
||||||
#>
|
#>
|
||||||
$sync.WPFMicrowinISOScratchDir.IsChecked
|
$sync.WPFMicrowinISOScratchDir.IsChecked
|
||||||
|
|
||||||
|
|
||||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||||
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
||||||
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
|
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
|
||||||
$Dialog.ShowDialog()
|
$Dialog.ShowDialog()
|
||||||
$filePath = $Dialog.SelectedPath
|
$filePath = $Dialog.SelectedPath
|
||||||
Write-Host "No ISO is chosen+ $filePath"
|
Write-Host "No ISO is chosen+ $filePath"
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ function Invoke-ScratchDialog {
|
|||||||
Write-Host "No Folder had chosen"
|
Write-Host "No Folder had chosen"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync.MicrowinScratchDirBox.Text = Join-Path $filePath "\"
|
$sync.MicrowinScratchDirBox.Text = Join-Path $filePath "\"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ function Invoke-WPFFixesWinget {
|
|||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Fixes Winget by running choco install winget
|
Fixes Winget by running choco install winget
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
BravoNorris for the fantastic idea of a button to reinstall winget
|
BravoNorris for the fantastic idea of a button to reinstall winget
|
||||||
#>
|
#>
|
||||||
|
@ -22,18 +22,18 @@ function Invoke-WPFGetIso {
|
|||||||
Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | "
|
Write-Host "/ /\/\ \| || (__ | | | (_) | \ /\ / | || | | | "
|
||||||
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
|
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
|
||||||
|
|
||||||
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
|
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
|
||||||
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
|
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
|
||||||
Write-Host "oscdimg.exe on system: $oscdImgFound"
|
Write-Host "oscdimg.exe on system: $oscdImgFound"
|
||||||
|
|
||||||
if (!$oscdImgFound)
|
if (!$oscdImgFound)
|
||||||
{
|
{
|
||||||
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
|
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
|
||||||
$sync.BusyMessage.Visibility="Hidden"
|
$sync.BusyMessage.Visibility="Hidden"
|
||||||
|
|
||||||
if (!$downloadFromGitHub)
|
if (!$downloadFromGitHub)
|
||||||
{
|
{
|
||||||
# only show the message to people who did check the box to download from github, if you check the box
|
# only show the message to people who did check the box to download from github, if you check the box
|
||||||
# you consent to downloading it, no need to show extra dialogs
|
# you consent to downloading it, no need to show extra dialogs
|
||||||
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
|
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
|
||||||
# the step below needs choco to download oscdimg
|
# the step below needs choco to download oscdimg
|
||||||
@ -41,7 +41,7 @@ function Invoke-WPFGetIso {
|
|||||||
Install-WinUtilChoco
|
Install-WinUtilChoco
|
||||||
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
|
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
|
||||||
Write-Host "choco on system: $chocoFound"
|
Write-Host "choco on system: $chocoFound"
|
||||||
if (!$chocoFound)
|
if (!$chocoFound)
|
||||||
{
|
{
|
||||||
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
|
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
|
||||||
return
|
return
|
||||||
@ -106,7 +106,7 @@ function Invoke-WPFGetIso {
|
|||||||
Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations."
|
Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Host "You have enough space for this operation."
|
Write-Host "You have enough space for this operation."
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
|
$sync.MicrowinScratchDirBox.Text = Join-Path $sync.MicrowinScratchDirBox.Text.Trim() '\'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect if the folders already exist and remove them
|
# Detect if the folders already exist and remove them
|
||||||
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
|
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ function Invoke-WPFGetIso {
|
|||||||
$randomMicrowin = "Microwin_${timestamp}_${randomNumber}"
|
$randomMicrowin = "Microwin_${timestamp}_${randomNumber}"
|
||||||
$randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}"
|
$randomMicrowinScratch = "MicrowinScratch_${timestamp}_${randomNumber}"
|
||||||
$sync.BusyText.Text=" - Mounting"
|
$sync.BusyText.Text=" - Mounting"
|
||||||
Write-Host "Mounting Iso. Please wait."
|
Write-Host "Mounting Iso. Please wait."
|
||||||
if ($sync.MicrowinScratchDirBox.Text -eq "") {
|
if ($sync.MicrowinScratchDirBox.Text -eq "") {
|
||||||
$mountDir = Join-Path $env:TEMP $randomMicrowin
|
$mountDir = Join-Path $env:TEMP $randomMicrowin
|
||||||
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
|
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
|
||||||
@ -180,12 +180,12 @@ function Invoke-WPFGetIso {
|
|||||||
Write-Host "Image dir is $mountDir"
|
Write-Host "Image dir is $mountDir"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
#$data = @($driveLetter, $filePath)
|
#$data = @($driveLetter, $filePath)
|
||||||
New-Item -ItemType Directory -Force -Path "$($mountDir)" | Out-Null
|
New-Item -ItemType Directory -Force -Path "$($mountDir)" | Out-Null
|
||||||
New-Item -ItemType Directory -Force -Path "$($scratchDir)" | Out-Null
|
New-Item -ItemType Directory -Force -Path "$($scratchDir)" | Out-Null
|
||||||
Write-Host "Copying Windows image. This will take awhile, please don't use UI or cancel this step!"
|
Write-Host "Copying Windows image. This will take awhile, please don't use UI or cancel this step!"
|
||||||
|
|
||||||
# xcopy we can verify files and also not copy files that already exist, but hard to measure
|
# xcopy we can verify files and also not copy files that already exist, but hard to measure
|
||||||
# xcopy.exe /E /I /H /R /Y /J $DriveLetter":" $mountDir >$null
|
# xcopy.exe /E /I /H /R /Y /J $DriveLetter":" $mountDir >$null
|
||||||
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" $mountDir -Recurse -Force }
|
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" $mountDir -Recurse -Force }
|
||||||
|
@ -33,12 +33,12 @@ function Invoke-WPFImpex {
|
|||||||
|
|
||||||
if($FileBrowser.FileName -eq ""){
|
if($FileBrowser.FileName -eq ""){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$Config = $FileBrowser.FileName
|
$Config = $FileBrowser.FileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type -eq "export"){
|
if ($type -eq "export"){
|
||||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
||||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
||||||
|
@ -92,7 +92,7 @@ public class PowerManagement {
|
|||||||
|
|
||||||
$mountDirExists = Test-Path $mountDir
|
$mountDirExists = Test-Path $mountDir
|
||||||
$scratchDirExists = Test-Path $scratchDir
|
$scratchDirExists = Test-Path $scratchDir
|
||||||
if (-not $mountDirExists -or -not $scratchDirExists)
|
if (-not $mountDirExists -or -not $scratchDirExists)
|
||||||
{
|
{
|
||||||
Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist."
|
Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist."
|
||||||
return
|
return
|
||||||
@ -149,7 +149,7 @@ public class PowerManagement {
|
|||||||
if (Test-Path "$env:TEMP\DRV_EXPORT")
|
if (Test-Path "$env:TEMP\DRV_EXPORT")
|
||||||
{
|
{
|
||||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ public class PowerManagement {
|
|||||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Host "Path to drivers is invalid continuing without driver injection"
|
Write-Host "Path to drivers is invalid continuing without driver injection"
|
||||||
}
|
}
|
||||||
@ -182,12 +182,12 @@ public class PowerManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# special code, for some reason when you try to delete some inbox apps
|
# special code, for some reason when you try to delete some inbox apps
|
||||||
# we have to get and delete log files directory.
|
# we have to get and delete log files directory.
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory
|
||||||
|
|
||||||
# Defender is hidden in 2 places we removed a feature above now need to remove it from the disk
|
# Defender is hidden in 2 places we removed a feature above now need to remove it from the disk
|
||||||
if (!$keepDefender)
|
if (!$keepDefender)
|
||||||
{
|
{
|
||||||
Write-Host "Removing Defender"
|
Write-Host "Removing Defender"
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory
|
||||||
@ -204,7 +204,7 @@ public class PowerManagement {
|
|||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\SecurityHealthSystray.exe"
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\SecurityHealthSystray.exe"
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
|
||||||
@ -285,7 +285,7 @@ public class PowerManagement {
|
|||||||
Write-Host "Disabling Teams"
|
Write-Host "Disabling Teams"
|
||||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d 0 /f >$null 2>&1
|
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d 0 /f >$null 2>&1
|
||||||
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 2 /f >$null 2>&1
|
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 2 /f >$null 2>&1
|
||||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f >$null 2>&1
|
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f >$null 2>&1
|
||||||
reg query "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" >$null 2>&1
|
reg query "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" >$null 2>&1
|
||||||
# Write-Host Error code $LASTEXITCODE
|
# Write-Host Error code $LASTEXITCODE
|
||||||
Write-Host "Done disabling Teams"
|
Write-Host "Done disabling Teams"
|
||||||
@ -327,7 +327,7 @@ public class PowerManagement {
|
|||||||
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f
|
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 1 /f
|
||||||
reg add "HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d '{\"pinnedList\": [{}]}' /f
|
reg add "HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d '{\"pinnedList\": [{}]}' /f
|
||||||
Write-Host "Done removing Sponsored Apps"
|
Write-Host "Done removing Sponsored Apps"
|
||||||
|
|
||||||
Write-Host "Disabling Reserved Storage"
|
Write-Host "Disabling Reserved Storage"
|
||||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d 0 /f
|
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d 0 /f
|
||||||
|
|
||||||
@ -351,8 +351,8 @@ public class PowerManagement {
|
|||||||
|
|
||||||
Write-Host "Unmounting image..."
|
Write-Host "Unmounting image..."
|
||||||
Dismount-WindowsImage -Path $scratchDir -Save
|
Dismount-WindowsImage -Path $scratchDir -Save
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Write-Host "Exporting image into $mountDir\sources\install2.wim"
|
Write-Host "Exporting image into $mountDir\sources\install2.wim"
|
||||||
@ -368,7 +368,7 @@ public class PowerManagement {
|
|||||||
}
|
}
|
||||||
Write-Host "Windows image completed. Continuing with boot.wim."
|
Write-Host "Windows image completed. Continuing with boot.wim."
|
||||||
|
|
||||||
# Next step boot image
|
# Next step boot image
|
||||||
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
|
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
|
||||||
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
|
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
|
||||||
|
|
||||||
@ -380,12 +380,12 @@ public class PowerManagement {
|
|||||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Host "Path to drivers is invalid continuing without driver injection"
|
Write-Host "Path to drivers is invalid continuing without driver injection"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Loading registry..."
|
Write-Host "Loading registry..."
|
||||||
reg load HKLM\zCOMPONENTS "$($scratchDir)\Windows\System32\config\COMPONENTS" >$null
|
reg load HKLM\zCOMPONENTS "$($scratchDir)\Windows\System32\config\COMPONENTS" >$null
|
||||||
reg load HKLM\zDEFAULT "$($scratchDir)\Windows\System32\config\default" >$null
|
reg load HKLM\zDEFAULT "$($scratchDir)\Windows\System32\config\default" >$null
|
||||||
@ -449,7 +449,7 @@ public class PowerManagement {
|
|||||||
Copy-ToUSB("$($SaveDialog.FileName)")
|
Copy-ToUSB("$($SaveDialog.FileName)")
|
||||||
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
|
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host " _____ "
|
Write-Host " _____ "
|
||||||
Write-Host "(____ \ "
|
Write-Host "(____ \ "
|
||||||
Write-Host " _ \ \ ___ ____ ____ "
|
Write-Host " _ \ \ ___ ____ ____ "
|
||||||
@ -469,9 +469,9 @@ public class PowerManagement {
|
|||||||
} else {
|
} else {
|
||||||
Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed."
|
Write-Host "ISO creation failed. The "$($mountDir)" directory has not been removed."
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
|
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
|
||||||
|
|
||||||
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
|
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
|
||||||
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"
|
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"
|
||||||
# Allow the machine to sleep again (optional)
|
# Allow the machine to sleep again (optional)
|
||||||
|
@ -20,7 +20,7 @@ function Invoke-WPFOOSU {
|
|||||||
$ProgressPreference = "SilentlyContinue" # Disables the Progress Bar to drasticly speed up Invoke-WebRequest
|
$ProgressPreference = "SilentlyContinue" # Disables the Progress Bar to drasticly speed up Invoke-WebRequest
|
||||||
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
|
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
|
||||||
|
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
"customize"{
|
"customize"{
|
||||||
Write-Host "Starting OO Shutup 10 ..."
|
Write-Host "Starting OO Shutup 10 ..."
|
||||||
|
@ -35,7 +35,7 @@ function Invoke-WPFPresets {
|
|||||||
Write-Debug $_
|
Write-Debug $_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($CheckBox in $CheckBoxes) {
|
foreach ($CheckBox in $CheckBoxes) {
|
||||||
$checkboxName = $CheckBox.Key
|
$checkboxName = $CheckBox.Key
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ function Invoke-WPFTweakPS7{
|
|||||||
)
|
)
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
"PS7"{
|
"PS7"{
|
||||||
if (Test-Path -Path "$env:ProgramFiles\PowerShell\7") {
|
if (Test-Path -Path "$env:ProgramFiles\PowerShell\7") {
|
||||||
Write-Host "Powershell 7 is already installed."
|
Write-Host "Powershell 7 is already installed."
|
||||||
} else {
|
} else {
|
||||||
@ -41,6 +41,6 @@ function Invoke-WPFTweakPS7{
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Settings file not found at $settingsPath"
|
Write-Host "Settings file not found at $settingsPath"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ function Invoke-WPFtweaksbutton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||||
|
|
||||||
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
||||||
|
|
||||||
if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default"){
|
if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default"){
|
||||||
|
@ -278,7 +278,7 @@ Add-Type @"
|
|||||||
$windowHandle = $proc.MainWindowHandle
|
$windowHandle = $proc.MainWindowHandle
|
||||||
} else {
|
} else {
|
||||||
Write-Warning "Process found, but no MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle)"
|
Write-Warning "Process found, but no MainWindowHandle: $($proc.Id) $($proc.MainWindowTitle)"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ $filter = Get-WinUtilVariables -Type Label
|
|||||||
$labels = @{}
|
$labels = @{}
|
||||||
$sync.GetEnumerator() | Where-Object {$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value}
|
$sync.GetEnumerator() | Where-Object {$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value}
|
||||||
|
|
||||||
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
|
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
|
||||||
|
|
||||||
$sync["CheckboxFilter"].Add_TextChanged({
|
$sync["CheckboxFilter"].Add_TextChanged({
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user