@@ -460,6 +460,11 @@ Begin {
460
460
461
461
)
462
462
Begin {
463
+ # # Add 'All' if nothing else was supplied
464
+ if (($PSBoundParameters.Keys | ? { $_ -notin " ShowFileHash" , " VerifyDigitalSignature" }).Count -eq 0 )
465
+ {
466
+ $All = [switch ]::Present
467
+ }
463
468
}
464
469
Process {
465
470
if ($All -or $BootExecute ) {
@@ -2160,30 +2165,38 @@ Begin {
2160
2165
If ($VerifyDigitalSignature ) {
2161
2166
if ($_.ImagePath ) {
2162
2167
If (Test-Path - Path $_.ImagePath - PathType Leaf) {
2163
- $_ | Add-Member - MemberType ScriptProperty - Name Signed - Value ({
2164
- try {
2165
- $signature = Get-AuthenticodeSignature - FilePath $ ($this.ImagePath ) - ErrorAction Stop
2166
- Switch ($signature.Status ) {
2167
- ' Valid' {
2168
- $true
2169
- break
2170
- }
2171
- ' NotSigned' {
2172
- $false
2173
- break
2174
- }
2175
- default {
2176
- $false
2177
- }
2178
- }
2179
-
2180
- } catch {
2168
+
2169
+ # # Add the signature status to the entry
2170
+ $signature = Get-AuthenticodeSignature - FilePath $_.ImagePath - ErrorAction Stop
2171
+ $signed = switch ($signature.Status ) {
2172
+ ' Valid' {
2173
+ $true
2174
+ break
2175
+ }
2176
+ ' NotSigned' {
2177
+ $false
2178
+ break
2179
+ }
2180
+ default {
2181
2181
$false
2182
2182
}
2183
- }) - Force - PassThru
2183
+ }
2184
+ $_ = $_ | Add-Member - MemberType NoteProperty - Name Signed - Value $signed - Force - PassThru
2185
+
2186
+ # # Add a note whether this is an OS binary to allow for easy filtering:
2187
+ # # Get-PSAutorun -VerifyDigitalSignature | ? { -not $_.IsOSBinary }
2188
+ if ($signature.IsOSBinary )
2189
+ {
2190
+ $_ = $_ | Add-Member - MemberType NoteProperty - Name IsOSBInary - Value $signature.IsOSBinary - Force - PassThru
2191
+ }
2192
+
2193
+ # # Add the signer itself
2194
+ $_ | Add-Member - MemberType NoteProperty - Name Publisher - Value $signature.SignerCertificate.Subject - Force - PassThru
2184
2195
}
2185
2196
} else {
2186
- $_ | Add-Member - MemberType NoteProperty - Name Signed - Value $null - Force - PassThru
2197
+ $_ = $_ | Add-Member - MemberType NoteProperty - Name Signed - Value $null - Force - PassThru
2198
+ $_ = $_ | Add-Member - MemberType NoteProperty - Name IsOSBinary - Value $null - Force - PassThru
2199
+ $_ | Add-Member - MemberType NoteProperty - Name Publisher - Value $null - Force - PassThru
2187
2200
}
2188
2201
} else {
2189
2202
$_
0 commit comments