|
@ -4,16 +4,6 @@ $FolderPath = "Sophia Script" |
|
|
$ExtensionsToSearchIn = @(".ps1", ".psm1", ".psd1") |
|
|
$ExtensionsToSearchIn = @(".ps1", ".psm1", ".psd1") |
|
|
# Get-ChildItem -Path Cert:\LocalMachine\My, Cert:\CurrentUser\My | Where-Object -FilterScript {$_.Subject -eq "CN=$CertName"} | Remove-Item |
|
|
# Get-ChildItem -Path Cert:\LocalMachine\My, Cert:\CurrentUser\My | Where-Object -FilterScript {$_.Subject -eq "CN=$CertName"} | Remove-Item |
|
|
|
|
|
|
|
|
if (Test-Path -Path "$PSScriptRoot\Sophia Script") |
|
|
|
|
|
{ |
|
|
|
|
|
Get-ChildItem -Path "Sophia Script" -Recurse -File |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Verbose -Message "No path" -Verbose |
|
|
|
|
|
Test-Path -Path $PSScriptRoot |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Generate a self-signed Authenticode certificate in the local computer's personal certificate store |
|
|
# Generate a self-signed Authenticode certificate in the local computer's personal certificate store |
|
|
$Parameters = @{ |
|
|
$Parameters = @{ |
|
|
Subject = $CertName |
|
|
Subject = $CertName |
|
@ -49,7 +39,7 @@ $codeCertificate = Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object -Fil |
|
|
# TimeStampServer specifies the trusted timestamp server that adds a timestamp to script's digital signature |
|
|
# TimeStampServer specifies the trusted timestamp server that adds a timestamp to script's digital signature |
|
|
# Adding a timestamp ensures that your code will not expire when the signing certificate expires |
|
|
# Adding a timestamp ensures that your code will not expire when the signing certificate expires |
|
|
# -Include *.ps1, *.psm1, *.psd1 is obvious, but it's slow |
|
|
# -Include *.ps1, *.psm1, *.psd1 is obvious, but it's slow |
|
|
|
|
|
# There is no need to user $PSScriptRoot\$FolderPath |
|
|
Get-ChildItem -Path $FolderPath -Recurse -File | Where-Object -FilterScript {$_.Extension -in $ExtensionsToSearchIn} | ForEach-Object -Process { |
|
|
Get-ChildItem -Path $FolderPath -Recurse -File | Where-Object -FilterScript {$_.Extension -in $ExtensionsToSearchIn} | ForEach-Object -Process { |
|
|
$Parameters = @{ |
|
|
$Parameters = @{ |
|
|
FilePath = $_.FullName |
|
|
FilePath = $_.FullName |
|
|