powershell

sethayes

·

step05

·

Powershell

·

Total Size: 2.37 KB

·

·

Created: 5 years ago

·

Edited: 5 years ago

$Log = "C:\Users\Public\Log.txt" [bool]$restart = $false filter timestamp {"$(Get-Date -Format G) | $_"} $av = (Get-WmiObject -NameSpace 'root\SecurityCenter2' -Class AntiVirusProduct | Select-Object DisplayName).DisplayName Function Remove-SEP { $sep64 = (Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "Symantech Endpoint Protection"} | Select-Object -Property UninstallString -ErrorAction SilentlyContinue).UninstallString $sep32 = (Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "Symantech Endpoint Protection"} | Select-Object -Property UninstallString -ErrorAction SilentlyContinue).UninstallString If ($sep64.Length -gt 0) { $sep = $($sep64.Replace(' /I',' /X')) Write-Output "Symantec Endpoint Protection Installed - Uninstalling Now..." | timestamp Write-Output "Symantec Endpoint Protection Installed - Uninstalling Now..." | timestamp | Out-File $Log -Append cmd.exe /c "$sep /quiet /qn /norestart" | Out-Null Write-Output "...Uninstalled Symantec Endpoint Protection" | timestamp Write-Output "...Uninstalled Symantec Endpoint Protection" | timestamp | Out-File $Log -Append } ElseIf ($sep32Length -gt 0) { $sep = $($sep32.Replace(' /I',' /X')) Write-Output "Symantec Endpoint Protection Installed - Uninstalling Now..." | timestamp Write-Output "Symantec Endpoint Protection Installed - Uninstalling Now..." | timestamp | Out-File $Log -Append cmd.exe /c "$sep /quiet /qn /norestart" | Out-Null Write-Output "...Uninstalled Symantec Endpoint Protection" | timestamp Write-Output "...Uninstalled Symantec Endpoint Protection" | timestamp | Out-File $Log -Append } } If ($av -like "*Symantec*") { Remove-SEP } If ([bool]$restart) { If (Test-Path C:\Users\Public\step06.ps1) { Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "ScriptStep" -Value "C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -File 'C:\Users\Public\step06.ps1'" } Restart-Computer -Force -Confirm:$false } Else { If (Test-Path C:\Users\Public\step06.ps1) { & "C:\Users\Public\step06.ps1" } }

0 bits

930 views

Are you sure you want to delete?