mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-04 15:00:09 +00:00
Comment Spacing, Indentation, and Capitalization (#1084)
* Comment Spacing, Indentation, and Capitalization * Comment Grammar and Spacing Makes grammar in comments better and more consistent Adds space before comment and centers word in `Write-Host` commands * More Grammar and Formatting * Add some comments * Populate PlaceHolder comments in functions Files I found that has issues: Get-WinUtilRegistry.ps1 Install-WinUtilWinget.ps1 Invoke-WinUtilDarkMode.ps1 Remove-WinUtilAPPX.ps1 Test-WinUtilPackageManager.ps1 Update-WinUtilProgramWinget.ps1 Invoke-WPFUpdatessecurity.ps1 * Tweak a few more comments * Tweak another write-host statement * Undo Catch statement adjustment It's outside of the scope of this pull request
This commit is contained in:
@@ -5,36 +5,10 @@
|
||||
GitHub : https://github.com/ChrisTitusTech
|
||||
Version : #{replaceme}
|
||||
#>
|
||||
param (
|
||||
[switch]$Debug,
|
||||
[string]$Config,
|
||||
[switch]$Run
|
||||
)
|
||||
|
||||
# Set DebugPreference based on the -Debug switch
|
||||
if ($Debug) {
|
||||
$DebugPreference = "Continue"
|
||||
}
|
||||
|
||||
if ($Config) {
|
||||
$PARAM_CONFIG = $Config
|
||||
}
|
||||
|
||||
$PARAM_RUN = $false
|
||||
# Handle the -Run switch
|
||||
if ($Run) {
|
||||
Write-Host "Running config file tasks..."
|
||||
$PARAM_RUN = $true
|
||||
}
|
||||
|
||||
if (!(Test-Path -Path $ENV:TEMP)) {
|
||||
New-Item -ItemType Directory -Force -Path $ENV:TEMP
|
||||
}
|
||||
|
||||
Start-Transcript $ENV:TEMP\Winutil.log -Append
|
||||
|
||||
# Load DLLs
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
|
||||
# Variable to sync between runspaces
|
||||
@@ -44,21 +18,9 @@ $sync.version = "#{replaceme}"
|
||||
$sync.configs = @{}
|
||||
$sync.ProcessRunning = $false
|
||||
|
||||
$currentPid = [System.Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = new-object System.Security.Principal.WindowsPrincipal($currentPid)
|
||||
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
|
||||
|
||||
|
||||
if ($principal.IsInRole($adminRole))
|
||||
{
|
||||
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
|
||||
clear-host
|
||||
}
|
||||
else
|
||||
{
|
||||
$newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
|
||||
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
|
||||
$newProcess.Verb = "runas";
|
||||
[System.Diagnostics.Process]::Start($newProcess);
|
||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "iwr -useb https://christitus.com/win | iex"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user