Ed The Dev .com

Edward Delaporte's Technical Journal

PowerShell script to list the free space on your drives

no comment

Here is the command:

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

But you could shorten it with some abbreviations:

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

And if you want precision rather than a clean answer:

gwmi Win32_LogicalDisk | % {$_.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

no comment

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

  1. Use the Start Menu to open the ‘Control Panel’.

    2

  2. From the Control Panel, open ‘Administrative Tools’.

    3

  3. From Adminstrative Tools, open ‘Services’.

    4

  4. In Services, scroll down and double click ‘Wireless Zero Configuration’.

    5

  5. In the Wireless Zero Configuration properties window, Change ‘Startup Type’ to ‘Automatic’ and press the ‘Start’ button if it is enabled (clickable). Then press Ok.

  6. Close the various windows, and give your wireless connection another try.

Enjoy!

  • Edward

Switch from PowerShell to Windows Explorer quickly

no comment

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, I quickly get an explorer window just by typing ‘exp’.

function explore ( [string] $dir )
{
    explorer.exe $dir
}
set-alias -name 'exp' -value explore

Usage: exp or exp 'subdirectory'

Enjoy!

  • Edward