If you hover over that button you will see a tool tip with information like this:
If there is more than 1 risk detected, the tooltip will specify that. If you click on the red button, you will get a menu like this:
You’ll notice a couple of options here.
Autocheck Scripts is on by default. If you would rather ISESteroids not do automatic risk analysis, you can simply click to turn it off. Right now, we’re going to Analyze Risks.
This will bring up a new window. See below:
Notice that it tells you which line the risk is on, and why that particular cmdlet is concerning. This one is for the “Remove-Item” cmdlet, which is inherently dangerous because it deletes things… Permanently.
Dismissing the risk will only do so for this script. If you were to open another script with the Remove-Item command in it, it would be flagged again. What if we decided that a cmdlet wasn’t risky at all? We could Whitelist it.
Now lets take a look at the Risk Manager. This is where you would go to manually view and/or modify how ISESteroids defines risk.
Click on the red button again, but this time go to Settings –> Manage Black/White Lists…
And you’ll be greeted by a window like this:
You can see that there are 3 lists.
No Risk is your WhiteList; ISESteroids will assume everything there is perfectly safe. The other two are Blacklists with varying degrees of severity. These fields are just editable text. You can add, remove, or modify anything in there. I t hink a “Reset to Default” might not be a bad idea in case of “Oops”, or you just want to clear everything custom out. For that reason I copied these into text files as backups just in case.
That’s pretty much covers the basics of Risk Analysis, so now a quick cover of.. .
So you want to restrict your environment to only run signed certificates? That process is not the most accessible. It takes a bit of know how, not only to create a code signing certificate, but to then make sure your script is signed (especially if you edit it after you’ve already signed it). It’s not impossible, though, and there are many blog posts out there on how to accomplish it. So what does ISESteroids bring to the table?
How about automatic certificate creation and digital signing with the click of a button?
First you’ll need to find the Digital Signature button. It’s down on the status bar, just to the right of the Risk Analysis button.
If you click this button you will get a menu like this:
We’re not going to look at any advanced options right now, so click Apply Signature. If you do not already have any certificates, it will bring up the Create Certificate window.
Click Yes to proceed and you will be given another window to actually create your certificate.
There are two fields you can fill in and a couple of check boxes:
Name: You can put anything here, but if it’s for work purposes you may want to come up with an identifiable moniker for your certificate.
Valid Until: This is the expiration date for the certficate. After this date scripts will need to be resigned.
Trust Certificate On This Computer: A useful option that is selected by default. This will automatically set the certificate to trusted so you can begin using it immediately on the local computer.
Create Exportable Certificate: If you’re serious about using this certificate to restrict code in your entire environment, you will want to check this box. This will allow you to use the certificate file in a tool like Group Policy so you can trust the certificate across an entire domain.
Once you are done filling that in, click Create. A Security Warning window will come up.
The warning refers to the fact that you just create a self-signed certificate. You can see that I named my certificate FooBartn. Windows is letting me know that it has no idea who FooBartn is, and I should make sure I do before trusting their certificate.
Since FooBartn is me… We’re all good here. Do take care installing certificates from untrusted sources, though.
Click Yes and you will be presented with a window where you can select a certificate.
If you already had a certificate earlier, when we first clicked Apply Signature, this is where it would’ve brought you to. We only have one certificate, so click OK.
That’s it. Your script is now digitally signed with your very own certificate.
If you take a look at the Digital Signature button on the status bar again, you will see that it has turned into a red ribbon. Click on it and you will see a couple different options:
If you were to edit your script, the Digital Signature icon would change again. The tooltip will read “You signed the script, but then edited it. The script content no longer matches the signature. Save file to update signature, or click for more options.
Save the file and Voila, your script has been re-signed. Spiffy, eh?
That’s all for now. Hopefully you found this useful and it assists you in providing a more secure scripting environment for your business!