1

I need to sign the scripts I write within ISE to run them. How can I get the path of the current open file in the active tab?

1 Answer 1

2
$psISE.CurrentFile.FullPath

Is the path to the file. It can be signed with a command like this:

Set-AuthenticodeSignature $psISE.CurrentFile.FullPath $certificate

ISE won't refresh to show the added signature text though, so consider including these commands to close and re-open the file:

$file = $psISE.CurrentFile
$psISE.CurrentPowerShellTab.Files.Remove($file)
$psISE.CurrentPowerShellTab.Files.Add($file.FullPath)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .