Skip to content

Monthly Archives: March 2008

PowerShell script to list the free space on your drives

Here is the command:

Get-WMIObject Win32LogicalDisk | ForEach-Object {[math]::truncate($.freespace / 1GB)}

But you could shorten it with some abbreviations:

gwmi Win32LogicalDisk | % {[math]::truncate($.freespace / 1GB)}

And if you want precision rather than a clean answer:

gwmi Win32LogicalDisk | % {$.freespace / 1GB}

The commands above will list the free space on each of your computers logical disks, so expect to see a list. Naturally, CD and DVD drives will be listed as having 0 free space.

Enable Window’s Wireless connection manager

I had a laptop that stopped connecting properly to Wireless networks. After some research, I discovered that my ‘Wireless Zero Configuration’ Windows service was not starting properly. Whenever I started it manually, it worked fine. I no longer use that laptop, but I have learned since then that the problem I saw is not uncommon in Windows XP laptops.

If you’re having the same issue, here’s instructions to start yours manually, and to set it to (hopefully) start automatically on it’s own in the future.

1

Switch from PowerShell to Windows Explorer quickly

Thanks to PowerShell Here I can conveniently get a PowerShell window from wherever I happen to be using Windows Explorer. But I vastly prefer to wander my directories inside of PowerShell, only switching to Explorer when I need to do something that Explorer does much better. (For example, source control through TortoiseSVN.)

Adding this function to my [PowerShell Profile][3], I quickly get an explorer window just by typing ‘exp’.