Created
April 18, 2019 08:59
-
-
Save Santaro255/72a3e94223fcb84c871d35b23f50a07d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
If you have UnknownError recreate script file with notepad. | |
This script must be signed first by | |
Set-AuthenticodeSignature -FilePath "PATH_TO_THIS_SCRIPT" -Certificate (Get-PfxCertificate "PATH_TO_CERT") | |
or just change ExecutionPolicy. | |
#> | |
function sign_cert($file) { | |
$certpath = "INSERT_PATH_TO_CERT" | |
$certpass = "INSERT_PASS_FOR_CERT" | |
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certpath, $certpass) | |
Set-AuthenticodeSignature -FilePath $file -Certificate $cert | |
} | |
$scriptfolder = Get-ChildItem "INSERT_FOLDER_WITH_SCRIPTS" | |
foreach ($item in $scriptfolder) { | |
sign_cert($item.FullName) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment