Skip to content

Commit

Permalink
Detect Autorun registry which may create issues with CMD
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsAddict committed Sep 3, 2024
1 parent 1484dd8 commit 3e974cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions static/get.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ if ($hash -ne $releaseHash) {
return
}

# Check for AutoRun registry which may create issues with CMD
$paths = "HKCU:\SOFTWARE\Microsoft\Command Processor", "HKLM:\SOFTWARE\Microsoft\Command Processor"
foreach ($path in $paths) {
if (Get-ItemProperty -Path $path -Name "Autorun" -ErrorAction SilentlyContinue) {
Write-Warning "Autorun registry found, CMD may crash! `nManually copy-paste the below command to fix...`nRemove-ItemProperty -Path '$path' -Name 'Autorun'"
}
}

$rand = [Guid]::NewGuid().Guid
$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:TEMP\MAS_$rand.cmd" }
Expand Down

0 comments on commit 3e974cf

Please sign in to comment.