I saw a script on the "Scripting Guy" series of posts but I didn't save the URL because it seemed a little complicated to me to do such a simple thing (I call the PowerShell using xp_CmdShell and parse the output from that). You might want to check there.
--Jeff Moden
Change is inevitable... Change for the better is not.