Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $PSVersionTable.PSVersion.ToString() + "`n"
- function Format-Color([hashtable] $Colors = @{}, [switch] $SimpleMatch) {
- $lines = ($input | Out-String) -replace "`r", "" -split "`n"
- foreach($line in $lines) {
- $color = ''
- foreach($pattern in $Colors.Keys){
- if(!$SimpleMatch -and $line -match $pattern) { $color = $Colors[$pattern] }
- elseif ($SimpleMatch -and $line -like $pattern) { $color = $Colors[$pattern] }
- }
- if($color) {
- Write-Host -ForegroundColor 'Green' $line
- } else {
- Write-Host -ForegroundColor 'Red' $line
- }
- }
- }
- echo "Checking FAT32 EFI partition..."
- mountvol S: /S
- $sig = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate
- $sig = [System.Security.Cryptography.X509Certificates.X509Certificate]::CreateFromSignedFile("S:\EFI\Microsoft\Boot\bootmgfw.efi")
- $sig2 = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $sig | Select-Object -ExpandProperty 'issuer'
- echo $sig2 | Format-Color @{ 'CA 2023' = 'dummy' }
- mountvol S: /D
- echo "Checking SecureBoot DB..."
- [System.Text.Encoding]::ASCII.GetString((Get-SecureBootUEFI db).bytes) -match 'Windows UEFI CA 2023' | Format-Color @{ 'True' = 'dummy' }
Advertisement
Add Comment
Please, Sign In to add comment