Adjust pattern for URL scraping

This commit is contained in:
Zehadi Alam
2024-09-17 21:08:09 -04:00
parent 7a2aab3204
commit ec7e9a546c
+2 -2
View File
@@ -2321,7 +2321,7 @@ function Get-MSRTUrl {
) )
try { try {
# Retrieve content of Windows Malicious Software Removal Tool page # Retrieve content of Windows Malicious Software Removal Tool page
$pattern = '\"url\":\"(https://download\.microsoft\.com/download/[^"]+)\"' $pattern = 'https:\/\/download\.microsoft\.com\/download\/[^\s]*\.exe'
$OriginalVerbosePreference = $VerbosePreference $OriginalVerbosePreference = $VerbosePreference
$VerbosePreference = 'SilentlyContinue' $VerbosePreference = 'SilentlyContinue'
if ($WindowsArch -eq "x64") { if ($WindowsArch -eq "x64") {
@@ -2337,7 +2337,7 @@ function Get-MSRTUrl {
WriteLog "Failed to retrieve Malicious Software Removal Tool URL. Pattern match failed" WriteLog "Failed to retrieve Malicious Software Removal Tool URL. Pattern match failed"
return return
} }
$MSRTUrl = $MSRTMatch.Groups[1].Value $MSRTUrl = $MSRTMatch.Value
return $MSRTUrl return $MSRTUrl
} }
catch { catch {