Archive for the ‘Powershell’ Category

Finding which LUN a datastore is on

January 25, 2018 Leave a comment

Recently we were doing some reconfiguration of our SAN and need to consolidate our VMFS datastores.  This required us to remove some LUNs and datastores.  While I was pretty confident in our naming convention was correct between VMWare and one of our SAN arrays I wanted to be extra careful when removing the LUNs.  To my surprise I could not find a way to see which LUN a datastore was on in VMWare vCenter (6.0).  I checked everywhere I could think of but could not find any mapping.

Even though this information is not exposed in vCenter you can easily find it with PowerCLI with a simple one liner.

get-datastore "Datastore Name" | Get-SCSILun | ft CanonicalName

This finds the VMFS datastore and pipes the object over to Get-SCSILun which returns the LUN it’s store on.  You can do this for all datastores but the Get-SCSILun cmdlet is very slow so if you have dozens or hundreds of datastores this can take a while to run.

Categories: Powershell, VMware

DISM GUI 3.5 Released

February 13, 2013 18 comments

It’s been almost a year since the last release but I just uploaded DISM GUI 3.5 to the Codeplex site this morning.  It contains a few background bug fixes and a few new features.  For this version I have kept it compatible with the Windows 7 WAIK and DISM version.

  • Added Edition Servicing tab
  • Added the ability to apply and unattend file
  • Added application servicing tab

It’s not a major release but adds most of the features available in the Windows 7 DISM program.  You will notice that there is no “online” functionality to allow it to operate on the running OS.  That is something I had planned to put in but was proving hard than I thought with the current version.  I’m hoping to include that in version 4.0

Speaking of version 4.0.  I don’t have a timeframe to release it yet but I do have some of the features planned.

  • Online mode – Allow DISM to be used against the currently running OS.
  • Windows ADK compatibility – The next version will rely on the Windows ADK and DISM version included in it.
  • WinPE compatibility – I am planning on making the next version work inside WinPE.
  • Powershell backend – This one is still up in the air but I may convert the backend to the new Powershell cmdlets instead of relying on DISM.exe.
      There might be more features added but this is what I am planning now.  If you have a suggestion add it to the



Codeplex DISM site

Exchange 2010 Mailbox Moves from CSV file

October 3, 2012 7 comments

Recently during our Exchange migration I wanted a way to automate our mailbox moves.  Even though PowerShell makes this is very easy to script I couldn’t just use a normal filter because the mailboxes I am moving need go to one of three different databases.   I couldn’t use the New-MoveRequest cmdlet with a normal filter because none of the mailboxes had any common attributes to filter on.    Instead I created a CSV file with the mailbox name and the target databases.  In the past this would have meant many lines of VBscript code but with PowerShell this can all be done with a one liner!  Then using PowerShell I read this information in and pipe it over to the New-MoveRequest cmdlet to initiate the mailbox moves. 

My CSV file looks like this.

UserID TargetDB
User01 MBX01
User02 MBX03
User03 MBX02

The PowerShell script looks like this.

Import-Csv .\Filename.csv | % {New-MoveRequest -Identity $_.UserID 

-TargetDatabase $_.TargetDB}

I also created another one for ad-hoc moves.  This Powershell script allows me to specify the CSV file that I want to use instead of hardcoding it into the script.


$csvfile = Read-Host "Enter in the name of the CSV File that contains the mailboxes you want to move"

Import-Csv $csvfile | % {New-MoveRequest -Identity $_.UserID -TargetDatabase $_.TargetDB}

If you haven’t started using PowerShell for scripting tasks I highly recommend that you start looking into it.  It’s got a bit of a learning curve but it’s very powerful once your get a good grasp on it.

Categories: Exchange, Powershell Tags: ,
%d bloggers like this: