Friday, January 23, 2015

PowerShell: Get a unique list of file name extensions within a directory folder (and sub-folders)

Here is a basic PowerShell script that will provide you a nice list of unique file name extensions for a given directory path. Nothing fancy here, but comes in handle once and a while.

Notice the -Recurse parameter that will drill down every sub-directory as well; remove this if you only want the top level directory.

Get-ChildItem -Path C:\Scripts -Recurse | Select-Object Extension | Sort-Object Extension | Get-Unique -asString

Woo-hoo!

Can't RDP? How to enable / disable virtual machine firewall for Azure VM

Oh no!  I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore.  I did ...