How to determine the type of storage (SAN / NAS / local disk) remotely using PowerShell?

I need to collect connected storage types for each server in our environment: several hundred W2K3 / W2K8 servers.

A script would be very useful to determine if the attached SAN / SAN mirrored / NAS / local or a combination of both. The problem is that I really did not find a good solution.

I was thinking about a script, and the best I could find would do something like this:

  • If the server uses a SAN , Veritas Storage Foundation is always installed, so I would look for it using gwmi win32_product. This is very slow and does not provide information if the SAN or SAN storage is mirrored.
  • If the NAS attached, there must be an iSCSI target IP address, and I would somehow look for it.

I really don't think these methods are acceptable. Could you help me find a better way to identify attached storage types in some way?

Many thanks

+6
source share
2 answers

I found an article on accessing the VDS service in powershell. Getting More Information About You LUNs Cluster

Massage the code a bit to get the type. It works even in 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) )" } } } 
+1
source

You can probably find the information 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 } 
0
source

All Articles