# show menu and question $baselineUrls = @( @("1. Windows Server 2025", "https://raw.githubusercontent.com/microsoft/osconfig/refs/heads/main/security/SecurityBaseline_WindowsServer_2025-2411.csv"), @("2. Defender Antivirus", "https://raw.githubusercontent.com/microsoft/osconfig/refs/heads/main/security/Defender_Antivirus-2411.csv"), @("3. Secured Core", "https://raw.githubusercontent.com/microsoft/osconfig/refs/heads/main/security/SecuredCore.csv") ) Write-Host "Select a security baseline" foreach ($baselineUrl in $baselineUrls) { Write-Host $baselineUrl[0] } $selection = Read-Host "Input # or enter to cancel" if (($selection -ge 1) -and ($selection -le 3)){ $baselineUrl = $baselineUrls[$selection - 1][1] } else { Write-Host "Canceled." exit } # download baseline csv to temporary file $tempFile = New-TemporaryFile $ret = Invoke-WebRequest -uri $baselineUrl $ret.Content |Out-File $tempFile $baselines = Import-Csv -Path $tempFile # search loop while ($true) { $findKey = $false $searchKey = Read-Host "Input baseline 'Name' or 'Control Name' or enter to exit" $searchKey = $searchKey.Trim() if ($searchKey.Length -eq 0) { Write-Host "Exited." Exit } foreach ($baseline in $baselines) { if ($baseline.Name.ToLower().Contains($searchKey.ToLower())) { $baseline $findKey = $true } elseif ($baseline."Control Name".ToLower().Contains($searchKey.ToLower())) { $baseline $findKey = $true } } if (!$findkey) { Write-Host "Not found." } }