# Exit from the current, unelevated, process. # Indicate that the process should be elevated. $NewProcess.Arguments = "& '" + $script:MyInvocation.M圜ommand.Path + "'" # Specify the current script path and name as a parameter with added scope and support for scripts with spaces in it's path. # We are not running as admin, so relaunch as admin. Relaunching as administrator." -ForegroundColor Yellow Write-Host "We are not running as administrator. $Host.UI.RawUI.WindowTitle = $myInvocation.M圜ommand.Definition + "(Elevated)" Write-Host "We are running as administrator, changing the title to indicate this." -ForegroundColor Green # We are running as an administrator, so change the title and background colour to indicate this. If ($myWindowsPrincipal.IsInRole($adminRole)) # Check to see if we are currently running as an administrator. # Get the security principal for the administrator role. $myWindowsPrincipal = New-Object ($myWindowsID) # Get the ID and security principal of the current user account. Write-Host "Checking for administrative rights." -ForegroundColor Yellow $x = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Write-Host "File deletion completed" -ForegroundColor Green Remove-Item -LiteralPath $MyInvocation.M圜ommand.Path -Force Write-Warning "Removing script files for security purposes." # Removing all script files for security reasons. Write-Warning "This script is not designed to run on a Server OS. If ((Get-WmiObject Win32_OperatingSystem).Caption -like '*server*') Write-Host "Checking OS version." -ForegroundColor Yellow Write-Host "Setting up." -ForegroundColor Yellow McAfee Endpoint Security Threat Prevention.McAfee Endpoint Security Adaptive Threat Prevention.It will self elevate as Administrator (requests creds if required) and here's what it will remove: The script is written in PowerShell and requires at least Version 3 or greater. The goal was to silently remove as many AV's as possible and I think I've done a decent job. I do not consider this script completed, but it does function 100%. I was talking to a co-worker who frequents Reddit and he made a suggestion to post a PowerShell script I've written recently. I currently work at a MSP in Maryland for about 4 years now and absolutely love what I do. I'm new here to Reddit and this community so I wanted to start by introducing myself.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |