misc.ps1
function Disable-WindowsHotkeys { #warning, disables all Windows Hotkeys including Win+R etc. $RegPath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" New-ItemProperty -Path $RegPath -Name "NoWinKeys" -Value 1 -PropertyType dword } function Enable-WindowsHotkeys { $RegPath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" New-ItemProperty -Path $RegPath -Name "NoWinKeys" -Value 0 -PropertyType dword } Function Test-Elevation{ Write-Verbose "Checking for elevated permissions..." if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Warning "Insufficient permissions to run this script. Open the PowerShell console as an administrator and run this script again." Return $false } else { Write-Verbose "Code is running as administrator — go on executing the script..." Return $true } } |