Microsoft Virtualization Discussions

Anyone using vSphere, SnapDrive & PowerShell? How would I get disk information from within the VM?

CBIRCHALL
2,912 Views

Hi,

There are loads of scripts to get information for audit/documentation such as names, cpu, memory & vmdk info and export it all to csv, Excel, html etc, but I am struggling to find out how to query VMs that have got NetApp SnapDrive installed and have got iSCSI Luns mounted (e.g. for Exchange & SQL)

I would like to just get a basic output such as:

VM Name - Drive letter - NetApp Lun Location - Size - Free space

Cheers in advance

2 REPLIES 2

JGPSHNTAP
2,912 Views

This seems like a pretty complex request.  Do you have something that you started to work on?

Also, you can use standard windows scripting to look for the presence of the snapdrive service, but i'm not sure what API's or powershell cmdlets are available if any for snapdrive other than SDCLI

bsti
2,912 Views

I do a lot of stuff like that.  Between ONTAP Powershell Toolkit and VMware PowerCLI you can get about anything you need.  I'm not sure if this is all you are looking for, a basic start would be to use Powershell to issue the sdcli command and parse the output via  custom function. 

function Get-NetAppDrives([string] $vmName)

{

  $output = sdcli disk list -m $vmName

  $drives = @()

  foreach ( $lineOut in $output )

  {

     #  Parse output here to find the bits of informatio you want, then build a custom object with the data:

    $drive = "" | Select-Object "VM", "DriveLetter","NetAppLunLocation","Size","FreeSpace"

    $drive.VM = $vmName

    $drive.DriveLetter = $driveLetter

  }

  return $drives

}

With a little bit of Powershell knowhow and some text parsing you can get most if not all the info you need.

Public