Thursday, December 7, 2017

Command of the Day - PowerShell

I wanted to list disk drives in Windows (not with DISKPART) using PowerShell. I wanted the output to look something similar to the one you get on a Linux OS.

sudo fdisk -l gives and output like this.










*sudo is required as Linux won't let you run these commands under a normal user.

After trying to be funky with variables to get the output of the 'wmic logicaldisk GET VolumeName, Size, Caption to show up in Gigabytes I had given up until I realised Powershell has a built-in command let to just do something like that!

get-psdrive –psprovider filesystem








Sometimes it takes a failed attempt to get to a successful place!

No comments:

#PowerShell HELP

PowerShell has one of the best help database built in to it, well it still has a long way to go to catch up with the Linux Man pages but yo...