Thanks to your super fast feedback, we were able to identify a couple of issues with the new PowerShell Obfuscator introduced in 188.8.131.52, and since we do not want obfuscation to break anything, we decided to ship a service release asap. Version 184.108.40.206 contains the fixes.
As a special “thank you”, we also added a new “file compare” feature that can save your day. Let’s take a look at the changes.
Obfuscation and Splatting
When you obfuscate a script, ISESteroids changes all variables to scrambled variable names, and places these new names into braces. When you splat a variable, these braces cause syntax errors because PowerShell interprets them as a hashtable. This was a quick fix, and in 220.127.116.11, the obfuscator now detects splatting and removes the braces in these cases.
New Obfuscation Features
When you choose Tools/Obfuscate, a dialog opens and lets you control many aspects of the obfuscation process. There are two options that were enhanced in 18.104.22.168:
- Create Obfuscation Table: when checked, ISESteroids creates a script with hashtables that list the old and new variable and function names. The hashtables are now nicely aligned.
- Save Obfuscated Script: This checkbox is available only when the script you are obfuscating is saved to file. When checked, the obfuscated script will be saved with the suffix “_obfuscated”. When unchecked, the obfuscated code will open as an “Untitled” document.
- Create New Pester Test: if you obfuscate a script that has a Pester test associated with it, and this option is checked, ISESteroids will generate a new Pester test for the obfuscated script as well. This is great because obfuscation bears the risk of breaking things, so now you can use your existing Pester tests to test the new obfuscated script as well.
File Compare has always been integrated in ISESteroids and was used with the file versioning control. Beginning with 22.214.171.124, you can now also perform ad-hoc file comparisons.
Let’s say you have been working on a script for a while. Now you are wondering what you have changed since you last saved the file. Simply right-click the editor tab and choose “Compare to”/”saved script”:
You can also compare the current script to any other open script. Any open editor tab qualifies. You can even compare “Untitled” content. ISESteroids then invokes the file compare tool. It now shows you in great detail all the changes between the two selected files.
With the buttons in the toolbar, you can navigate to the next or previous change, and you can even undo individual changes. Once you close the file comparison tool and save the changes, ISESteroids automatically updates your script. This way, it becomes a snap to undo part or all of the changes.
We noticed an issue with the new Pester integration. Occasionally, when you add a new Pester test to the test script via click on the Pester overlay and “Create Test For Function …”, the new “Describe” block seems to be inserted into the existing test file at a wrong position. We scratched our heads hard but can’t seem to reproduce.
So if you do experience this problem, please report. Better yet, try and see if you can find repro steps that trigger this behavior. Thanks a lot!