Monday, December 13, 2010

Free Space on all servers for all fixed drives? Done.

A while ago I posted on querying free disk space using WMI and batch.

I wouldn't query free disk space using batch anymore.  The PowerShell script I tweaked and currently use to query free disk space is displayed below.  The script truncates for readability – the rounding methods are commented out if that’s your preference:
# spaceused.ps1
# Lars-UT http://larsrasmussen.blogspot.com
(Get-Date -format 'yyyy-MM-dd hh:mm:ss').ToString() | Out-Default
$outData = @("")
$server = $args[0]
$dataFromServer = Get-WmiObject Win32_Volume -ComputerName $server | Select-Object SystemName,Label,Name,DriveLetter,DriveType,Capacity,Freespace

foreach ($currline in $dataFromServer) {
if ((-not $currline.name.StartsWith("\\")) -and ($currline.Drivetype -ne 5)) {
[float]$tempfloatcapacity = [math]::truncate($currline.Capacity/ 1000000000)
#[float]$tempfloatcapacity = [math]::round(($currline.Capacity/ 1000000000),1)
add-member -InputObject $currline -MemberType NoteProperty -name Capacity_in_GB -value "$tempfloatcapacity GB"

[float]$tempfloat = ($currline.Freespace / 1000000) / ($currline.Capacity / 1000000)
$temppercent = [math]::round(($tempfloat * 100),2)
add-member -InputObject $currline -MemberType NoteProperty -name FreePercent -value "$temppercent %"

[float]$tempfloatfreespace = [math]::truncate($currline.Freespace/ 1000000000)
#[float]$tempfloatfreespace = [math]::round(($currline.Freespace/ 1000000000),1)
add-member -InputObject $currline -MemberType NoteProperty -name Freespace_in_GB -value "$tempfloatfreespace GB"

$outData = $outData + $currline
}
}

$outData | Select-Object SystemName,Label,Name,Capacity_in_GB,Freespace_in_GB,FreePercent | sort-object -property Name | format-table -autosize

To run this against muliple servers just put the server names, one per line, in a text file and save that file. You'll then assign that file to a variable in PowerShell and loop through each line for each server:

PS C:\> $serverlist = Get-Content .\ServerNames-Prod.txt
PS C:\> foreach ($server in $serverlist) { .\spaceused.ps1 $server }


Here’s the pretty output!  Yep, those are sub-second times for querying multiple servers.



spaceused.ps1



Need to document this?  Use Start-Transcript.  I’ve seen auditors use it like so:



PS C:\> $strTimestamp =  [string](Get-Date -format "yyyy-MM-dd_hh-mm")
PS C:\> start-transcript .\ServerSpace-$strTimestamp.txt
PS C:\> foreach ($server in $serverlist) { .\spaceused.ps1 $server }
PS C:\> Stop-Transcript


Enjoy.

Friday, September 03, 2010

Music for Entering or Staying in “The Zone”

The zone.  It’s that special place where you find the ability to intensely focus and compress large workloads or complex tasks.  Good music can help, whether its classical, inspirational, ambient, or just familiar.  I often listen to music with no vocals to minimize the distractions surrounding my cubicle.

Here are a few oft-played tracks on my system courtesy of Grooveshark as an example:

I also listen to SomaFM – you should be able to find channels there for your particular taste, such as:

Groove Salad
Space Station Soma
Mission Control
Lush
Suburbs of Goa
Drone Zone
Underground 80s

Sometimes you want to listen to a specific track immediately.  The GrooveSelect and Search GrooveShark bookmarklets will instantly cue it up.

Wednesday, September 01, 2010

Thermal Reactor > Fast Reactor: August CTO Breakfast Notes

“We can build self-controlling reactors.”

YouTube - Thorium Remix 2009 - LFTR in 25 Minutes
http://www.youtube.com/watch?v=EHdRJqi__Z8

The Liquid Fluoride Thorium Reactor: What Fusion Wanted To Be
http://www.youtube.com/watch?v=AHs2Ugxo7-8


Kynetx Demo from Sam Curren – Holy Personal Data Stores!


UTOSC (Utah Open Source Conference) 2010 - October 7-9, 2010
http://utosc.com/


The Future of UI
http://blog.ted.com/2010/06/01/drive_3d_data_w/


AppInventor
http://appinventor.googlelabs.com/about/


Blue Ant T1 Bluetooth Headset – Scott Lemon is converted to this headset model.
http://www.myblueant.com/products/headsets/t1/index.php#video


Swype text input for Android phones – heavily endorsed by Sam.
http://swypeinc.com/

Hope to see you at the next CTO Breakfast!