Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
LuSlower authored Jul 2, 2024
1 parent 251d2a8 commit a306d4a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Device-Affinity-Checker.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Check administrator privileges
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
$delay = 2
if (-not $isAdmin) {
[System.Windows.Forms.MessageBox]::Show("Run the script as administrator", "Error", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
Start-Sleep -Seconds $delay
Exit
# Check administrator privileges
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell "-File `"$PSCommandPath`"" -Verb RunAs
exit
}

Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

Expand Down

0 comments on commit a306d4a

Please sign in to comment.