| 1 |
<# |
| 2 |
.Synopsis |
| 3 |
Recursively signs the contents of a directory. |
| 4 |
.Description |
| 5 |
Given the file patterns, code signs the contents. |
| 6 |
.Parameter root |
| 7 |
The root directory to sign. |
| 8 |
.Parameter patterns |
| 9 |
The file patterns to sign |
| 10 |
.Parameter description |
| 11 |
The description to add to the signature (optional). |
| 12 |
.Parameter certname |
| 13 |
The name of the certificate to sign with (optional). |
| 14 |
.Parameter certsha1 |
| 15 |
The SHA1 hash of the certificate to sign with (optional). |
| 16 |
#> |
| 17 |
param( |
| 18 |
[Parameter(Mandatory=$true)][string]$root, |
| 19 |
[string[]]$patterns=@("*.exe", "*.dll", "*.pyd", "*.cat"), |
| 20 |
[string]$description, |
| 21 |
[string]$certname, |
| 22 |
[string]$certsha1, |
| 23 |
[string]$certfile |
| 24 |
) |
| 25 |
|
| 26 |
$tools = $script:MyInvocation.MyCommand.Path | Split-Path -parent; |
| 27 |
Import-Module $tools\sdktools.psm1 -WarningAction SilentlyContinue -Force |
| 28 |
|
| 29 |
pushd $root |
| 30 |
try { |
| 31 |
Sign-File -certname $certname -certsha1 $certsha1 -certfile $certfile -description $description -files (gci -r $patterns) |
| 32 |
} finally { |
| 33 |
popd |
| 34 |
} |