summaryrefslogtreecommitdiff
path: root/_site/get.ps1
diff options
context:
space:
mode:
authorWindowsAddict2024-04-01 05:31:16 +0000
committerWindowsAddict2024-04-01 05:31:16 +0000
commitc046fa4b6022eecefdfc98d8419a011c64774472 (patch)
tree9b0d47cc0d872676cbb747b8025eab29f649602f /_site/get.ps1
parent17a838045fa7bd6ed87f6d1580152d0e3e444e5b (diff)
downloadmassgrave.dev-c046fa4b6022eecefdfc98d8419a011c64774472.zip
Update get.ps1 script
Diffstat (limited to '_site/get.ps1')
-rw-r--r--_site/get.ps121
1 files changed, 14 insertions, 7 deletions
diff --git a/_site/get.ps1 b/_site/get.ps1
index 265ba14..086048e 100644
--- a/_site/get.ps1
+++ b/_site/get.ps1
@@ -9,19 +9,26 @@ $DownloadURL1 = 'https://bitbucket.org/WindowsAddict/microsoft-activation-script
$DownloadURL2 = 'https://codeberg.org/massgravel/Microsoft-Activation-Scripts/raw/branch/master/' + $CommonURLPart
$DownloadURL3 = 'https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/master/' + $CommonURLPart
-$rand = Get-Random -Maximum 99999999
-$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" }
-
-$RandomURL = Get-Random -InputObject $DownloadURL1, $DownloadURL2
+$URLs = @($DownloadURL1, $DownloadURL2)
+$RandomURL1 = Get-Random -InputObject $URLs
+$RandomURL2 = $URLs -notmatch $RandomURL1 | Get-Random
try {
- $response = Invoke-WebRequest -Uri $RandomURL -UseBasicParsing
+ $response = Invoke-WebRequest -Uri $RandomURL1 -UseBasicParsing
}
catch {
- $response = Invoke-WebRequest -Uri $DownloadURL3 -UseBasicParsing
+ try {
+ $response = Invoke-WebRequest -Uri $RandomURL2 -UseBasicParsing
+ }
+ catch {
+ $response = Invoke-WebRequest -Uri $DownloadURL3 -UseBasicParsing
+ }
}
+$rand = Get-Random -Maximum 99999999
+$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" }
+
$ScriptArgs = "$args "
$prefix = "@:: $rand `r`n"
$content = $prefix + $response