6

I have to collect the attached storage types of each server in our environment: Several hundreds of W2K3/W2K8 servers.

A script would be very useful to determine if the attached storage is SAN / SAN mirrored / NAS / local or combination of these. The problem is that I haven't really found any good solution.

I was thinking about a script, and the best I could figure out would do something like the following:

  • If the server uses SAN, Veritas Storage Foundation is always installed, so I would search for it with gwmi win32_product. This is really slow, and this doesn't provide the information if the storage is SAN, or SAN mirrored.
  • If the attached storage is NAS, there must be an ISCSI target ip, and I would search for that somehow.

I really don't think these methods are acceptable though. Could you please help me find a better way to determine the attached storage types somehow?

Thank you very much

Kjartan
  • 18,591
  • 15
  • 71
  • 96
Bela
  • 61
  • 1
  • 1
  • 2
  • Do you have PS2.0 on the W2k3 servers? – Frode F. Jan 25 '13 at 10:21
  • use diskpart ? ex diskpart, select disk 1 , detail disk : type will be iSCSI for SAN disk – Loïc MICHEL Jan 25 '13 at 10:53
  • Have you worked out how to do this *locally*? (Ie. is this a remoting question or a system information question?) – Richard Jan 25 '13 at 12:36
  • This must be a system information question since he explains how he first plan it(searching for veritas storage foundation etc.) and then ask for improved methods to detect storage type. – Frode F. Jan 25 '13 at 12:45

2 Answers2

2

I found an article about accessing the VDS service in powershell. Getting More Information About You Cluster LUN’s

Massaged the code a bit to get type. Works even on 2003.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Storage.Vds") | Out-Null
$oVdsServiceLoader = New-Object Microsoft.Storage.Vds.ServiceLoader
$oVdsService = $oVdsServiceLoader.LoadService($null) 
$oVdsService.WaitForServiceReady() 
$oVdsService.Reenumerate() 
$cDisks = ($oVdsService.Providers |% {$_.Packs}) |% {$_.Disks}
$cPacks = $oVdsService.Providers |% {$_.Packs}

foreach($oPack in $cPacks)
{
    If($oPack.Status -eq "Online")
    {
        foreach($oDisk in $oPack.Disks)
        {
            Write-Host "$($oDisk.FriendlyName) ( $($oDisk.BusType) )"
        }


        foreach($oVolume in $oPack.Volumes)
        {
            Write-Host "`t$($oVolume.AccessPaths) ( $($oVolume.Label) )"
        }

    }
}
Ian King
  • 21
  • 2
1

You could probably find the info in one of the following WMI classes:

Win32_LogicalDisk http://msdn.microsoft.com/en-us/library/windows/desktop/aa394173(v=vs.85).aspx

Win32_Volume http://msdn.microsoft.com/en-us/library/windows/desktop/aa394515(v=vs.85).aspx

Win32_DiskDrive http://msdn.microsoft.com/en-us/library/windows/desktop/aa394132(v=vs.85).aspx

Then... do something like:

Get-AdComputer Server* | Foreach-Object { Get-WmiObject -Class Win32_DiskDrive -ComputerName $_.Name }
riro
  • 121
  • 4