Update CheckFile
This commit is contained in:
parent
1b590c2404
commit
3c1dae87b1
18
get
18
get
@ -1,14 +1,5 @@
|
|||||||
# This script is hosted on https://get.activated.win for https://massgrave.dev
|
# This script is hosted on https://get.activated.win for https://massgrave.dev
|
||||||
|
|
||||||
function CheckFile {
|
|
||||||
if (-not (Test-Path -Path $FilePath)) {
|
|
||||||
Check3rdAV
|
|
||||||
Write-Host "Failed to create MAS file in temp folder, aborting!"
|
|
||||||
Write-Host "Help - https://massgrave.dev/troubleshoot" -ForegroundColor White -BackgroundColor Blue
|
|
||||||
throw
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Check3rdAV {
|
function Check3rdAV {
|
||||||
$avList = Get-CimInstance -Namespace root\SecurityCenter2 -Class AntiVirusProduct | Where-Object { $_.displayName -notlike '*windows*' } | Select-Object -ExpandProperty displayName
|
$avList = Get-CimInstance -Namespace root\SecurityCenter2 -Class AntiVirusProduct | Where-Object { $_.displayName -notlike '*windows*' } | Select-Object -ExpandProperty displayName
|
||||||
if ($avList) {
|
if ($avList) {
|
||||||
@ -62,10 +53,15 @@ $isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -mat
|
|||||||
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:USERPROFILE\AppData\Local\Temp\MAS_$rand.cmd" }
|
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:USERPROFILE\AppData\Local\Temp\MAS_$rand.cmd" }
|
||||||
Set-Content -Path $FilePath -Value "@::: $rand `r`n$response"
|
Set-Content -Path $FilePath -Value "@::: $rand `r`n$response"
|
||||||
|
|
||||||
CheckFile
|
|
||||||
$env:ComSpec = "$env:SystemRoot\system32\cmd.exe"
|
$env:ComSpec = "$env:SystemRoot\system32\cmd.exe"
|
||||||
Start-Process -FilePath $env:ComSpec -ArgumentList "/c """"$FilePath"" $args""" -Wait
|
Start-Process -FilePath $env:ComSpec -ArgumentList "/c """"$FilePath"" $args""" -Wait
|
||||||
|
|
||||||
CheckFile
|
if (-not (Test-Path -Path $FilePath)) {
|
||||||
|
Check3rdAV
|
||||||
|
Write-Host "Failed to create MAS file in temp folder, aborting!"
|
||||||
|
Write-Host "Help - https://massgrave.dev/troubleshoot" -ForegroundColor White -BackgroundColor Blue
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
$FilePaths = @("$env:SystemRoot\Temp\MAS*.cmd", "$env:USERPROFILE\AppData\Local\Temp\MAS*.cmd")
|
$FilePaths = @("$env:SystemRoot\Temp\MAS*.cmd", "$env:USERPROFILE\AppData\Local\Temp\MAS*.cmd")
|
||||||
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }
|
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }
|
||||||
|
Loading…
Reference in New Issue
Block a user