Skip to content

Commit

Permalink
Sign ps1xml
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd committed Sep 8, 2019
1 parent 16d2e9a commit a39c98e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions signModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ param($Thumbprint)
$ErrorActionPreference = 'Stop'

$cert = Get-ChildItem Cert:\CurrentUser\My |
where Thumbprint -eq $Thumbprint
Where-Object Thumbprint -eq $Thumbprint

if ($null -eq $cert) {
throw "No certificate was found."
Expand All @@ -14,8 +14,8 @@ if (@($cert).Length -gt 1) {

"Signing Files"
$files = Get-ChildItem -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Extension -in ".ps1", ".psm1", ".psd1", ".dll" } |
Select-Object -ExpandProperty FullName
Where-Object { $_.Extension -in ".ps1", ".psm1", ".psd1", ".ps1xml", ".dll" } |
Select-Object -ExpandProperty FullName

$incorrectSignatures = Get-AuthenticodeSignature -FilePath $files | Where-Object { "Valid", "NotSigned" -notcontains $_.Status }
if ($incorrectSignatures) {
Expand All @@ -29,7 +29,7 @@ if (-not @($filesToSign)) {
}

$results = $filesToSign |
ForEach-Object {
ForEach-Object {
$r = Set-AuthenticodeSignature $_ -Certificate $cert -TimestampServer 'http://timestamp.digicert.com' -ErrorAction Stop
$r | Out-String | Write-Host
$r
Expand Down

0 comments on commit a39c98e

Please sign in to comment.