Hi All,
I know this isn’t strictly PowerShell, but I thought this was the best place to ask.
I am making a few PowerShell scripts from work, but whenever I change anything, I have to go through the process of resigning the file using this script:
Set-AuthenticodeSignature -FilePath <PATH> -Certificate (Get-ChildItem -Path Cert:\CurrentUser\My\ -CodeSigningCert)
I was wondering if there’s a way of making so I can right click on a PS1 file and click Sign this File. I’ve tried doing this myself but cannot get the Registry part of it working…
It needs to go something like this:
- I right click on Mail Merger.ps1
- I click Sign This File
- When I click that, it launches a script I made earlier called SignThisFile in PowerShell passing in the path to Mail Merger.ps1 as an argument
- That script calls the signature in the code block above, passing in the file name we got from Registry through the right click menu.
So far I’ve used PowerShell to make a Mail Merger and a Report Splitter for the college I work at and I’m going to be doing more with PowerShell in the coming months and having to go through the process of finding the command again, copying and pasting it into PowerShell, finding the PS1, clicking copy path and replacing the path is getting a little tiresome.
And since PowerShell is all about automating the boring stuff, I thought I could maybe automate signing?
Thanks in advance for your help,
Steven