Posts

Showing posts from November, 2010

Create iOS like page using Powershell

Summary: I was simply bored w/ the standard directory listing provided by IIS and was inspired by a page I saw.  I decided to make one modeled after that one and automatically generated using PowerShell.  I added some tooltips and text below the images while I was at it.  I run this script now every 5 minutes on my server to have something pretty to look at before going to my ugly reports . Anyway you can view a live example here:  http://techexamples.zsoldier.com I filled up the directory w/ copies of one html file just to show what page looks like when there are lots of html files. Here is the Powershell script: http://techexamples.zsoldier.com/Create-HTMLDefaultDirectoryPage.ps1 I utilized CSS for all images.  My next steps when I get time are to: Extract <title> tags from the html files in the directory and have them inserted into the tooltip. Preview the target report via a screenshot and place into the tooltip. Extract the apple-touch-icon tag to use the images

PowerCLI weirdness around Get-SCSILun and where statement

Summary: Using a where –eq statement against the objects provided by the Get-SCSILun either the vendor or model properties ends w/ 0 objects returned.  The following is an example: Example: 1: Get-VMhost myESXHost | Get-SCSILun | where {$_.Model -eq "SYMMETRIX" } 2: Get-VMhost myESXHost | Get-SCSILun | where {$_.Vendor -eq "EMC" } These two examples will likely return 0 results because the Model property is ALWAYS 16 characters and the Vendor property is ALWAYS 8 characters.  Each property are padded w/ spaces.  How did I figure this out?  Like this: 1: $Test = Get-VMhost myESXHost | Get-SCSILun | where {$_.Model -eq "SYMMETRIX" } 2: $Test[0].Model.Length <-- This returns 16 3: $Test[0].Vendor.Length <-- This returns 8 Resolution: I suggest using –like or –match when querying against these properties.  I prefer match, but to each their own.  Like so: 1: Get-VMhost myESXHost | Get-SCSILun | where {$_.Model -match &quo