添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hello,
I am trying to gather some disk information. Im trying to make it easier to submit the information to the storage team when we have to get Windows san disks extended.

This script does not get the letter or volume name, anyone point out why? It outputs the hostname and drive number, but the next 2 fields are blank.

$computer = Get-WmiObject -Class Win32_ComputerSystem
$hostname = $computer.Name
$disks = Get-WmiObject -Class Win32_DiskDrive
foreach ($disk in $disks) {
    $index = $disk.Index
    $partitions = Get-WmiObject -Class Win32_DiskPartition -Filter "DiskIndex = $index"
    foreach ($partition in $partitions) {
        $letter = (Get-WmiObject -Class Win32_LogicalDisk | Select-Object {$_.DeviceID})
        $volumename = (Get-WmiObject -Class Win32_LogicalDisk | Select-Object {$_.VolumeName})
        #$label = (Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceID='$($partition.DeviceID)'" ).VolumeName
        Write-Host "Hostname: $hostname" -ForegroundColor Green
        Write-Host "Drive Index: $index" -ForegroundColor Green
        Write-Host "Drive Letter: $letter" -ForegroundColor Green
        Write-Host "Drive Label: $volumename" -ForegroundColor Green

This is really only the first part, because once I have this information, I need to run “powermt display dev=all” to be able to get the WWN of each disk.

The output of the powermt command looks like this:

Pseudo name=harddisk24
Symmetrix ID=00046546456
Logical device ID=00000222
Device WWN=6000097563456467567565646
state=alive; policy=SymmOpt; queued-IOs=0
==============================================================================
--------------- Host ---------------   - Stor -  -- I/O Path --   -- Stats ---
###  HW Path               I/O Paths    Interf.  Mode     State   Q-IOs Errors
==============================================================================
   4 port4\path0\tgt1\lun24 c4t1d24    FA  8d:04 active   alive      0      0
   4 port4\path0\tgt0\lun24 c4t0d24    FA 10d:04 active   alive      0      0
   3 port3\path0\tgt1\lun24 c3t1d24    FA  9d:05 active   alive      0      0
   3 port3\path0\tgt0\lun24 c3t0d24    FA  7d:05 active   alive      0      0

So I need to correlate the Pseudo name=harddisk24 with Index number 24 from the first script output, and then grab the Device WWN.

But…I cant get the first script working :frowning:

Any help would be great, Thanks!

First of all: You should not use Get-WmiObject anymore as it is deprecated and can be replaced with its successor