Add -LiteralPath

This commit is contained in:
DESKTOP-RBH716R\Admin 2022-07-27 21:39:57 +05:30
parent 40d1a4be98
commit f268429d21

View File

@ -1,17 +1,18 @@
# Enable TLSv1.2 for compatibility with older clients # Enable TLSv1.2 for compatibility with older clients
$Tls12 = [Enum]::ToObject([System.Net.SecurityProtocolType], 3072); [System.Net.ServicePointManager]::SecurityProtocol = $Tls12; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12
$DownloadURL = 'https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/master/MAS/All-In-One-Version/MAS_AIO.cmd' $DownloadURL = 'https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/master/MAS/All-In-One-Version/MAS_AIO.cmd'
$FilePath = "$env:TEMP\MAS.cmd"
try { try {
Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing -OutFile "$env:TEMP\MAS.cmd" Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing -OutFile $FilePath
} catch { } catch {
Write-Error $_ Write-Error $_
Return Return
} }
if (Test-Path -Path "$env:TEMP\MAS.cmd") { if (Test-Path -LiteralPath $FilePath) {
Start-Process -FilePath "$env:TEMP\MAS.cmd" -Wait Start-Process $FilePath -Wait
Remove-Item -Path "$env:TEMP\MAS.cmd" -Force Remove-Item -LiteralPath $FilePath -Force
} }