v4

Testing for Admin Privileges in PowerShell

Sometimes when running a PowerShell script you may need to test at the beginning whether the process it was called from had Windows admin privileges in order to be able to achieve what it needs to do. Prior to PowerShell v4 I had used something along the lines of the following to test for this condition - not the most obvious piece of code ever to be fair: function Test-IsAdmin { (\[Security.

Creating PowerShell ISE v3 (and later) Code Snippets

When using the PowerShell ISE , similar to other scripting editors, you have access to what are known as ‘code snippets’. These are quick start ways to generate frequently used code, for instance if there is something you use regularly and can never remember the syntax for, or maybe it is too long to be practical to remember it. PowerShell ships with some default snippets and it is also possible to add some custom snippets of your own.