Articles

PowerShell articles, tutorials, and guides from community experts.

pwshliquori
PowerShell for Admins

Find-Module, Find-Script – Don't Recreate the Wheel

The PowerShell Gallery is a collection of modules and scripts that is community driven to help us automate everyday tasks. Sometimes, we have an idea that could written into a function or script, however, most of the time, someone else had the same idea and published their work to the PowerShell Gallery. There is no need to recreate the wheel and re-write it, use the community to our advantage. We’ll take a look at multiple Cmdlets,

Mark Roloff
PowerShell for Admins

Phenomenal number of ACLs, itty-bitty living space

I recently had a need to backup file and folder ACLs for a client that would then need to restore them to their original objects following a hardware upgrade that would wipe them out. Easy enough, but the catch was that there was 1.5 million of them. Fortunately, getting ACLs in PowerShell is easy. `PS > Get-Acl -Path somefile.txt Directory: C: Path Owner Access somefile.txt BUILTIN\Administrators BUILTIN\Administrators Allow… `See? Now, if you needed multiple ACLs, say, all 1.

pwshliquori
PowerShell for Admins

Azure DevOps – Enable "Allow scripts to access the OAuth token" using PowerShell

Azure DevOps allows us to run custom scripts to help our software and infrastructure get delivered quickly. There are times that the scripts run without an issue, however, sometimes there is a need to invoke the Azure DevOps Rest API in the release pipeline to get our scripts running. Sure, you can create a script invoking the API, authenticating with Azure DevOps with your personal access token and should work, but there is a better solution.

pwshliquori
PowerShell for Admins

Get-Command – One of the best Cmdlets besides Get-Help

So laying on the sofa, sick, bored out of my mind, what better way to spend my time then writing a blog post about Get-Command . The Get-Command Cmdlet is apart of the Microsoft.PowerShell.Core module, it was introduced in PowerShell version 1.0 and is one of the most useful Cmdlets to find a command you are looking for. It has a variety of parameters that allow you to search for a command by using a combination of parameters or just using

Nathaniel Webb (ArtisanByteCrafter)
PowerShell for Admins

Learn To Use Verbose Output Streams In Your Pester Tests

I’m going to file this under “Either I’m a genius, or there’s a much better way and everyone knows it except for me.” I recently began adding a suite of Pester tests to one of my projects and I found myself needing to mock some unit tests against a particular function that would modify a variable based on the parameter specified. Since all the functions I write nowadays are considered advanced functions (and yours should be too, they’re free!

pwshliquori
Tips and Tricks

Hear, Hear for Here-Strings

Running commands in PowerShell that require a format that will not run natively in PowerShell could be a difficult task, or can it? PowerShell provides a way to store, for example, a JSON as a string, enter here-string. A here-string is a single or double quoted string in which the quotation marks are interpreted literally. An example would be invoking a Rest API that requires a JSON body. Lets take a look at an example and see how here-strings work.