When manually pulling the smart info using the NAA Identifier it works. But when it is stored in a variable, it doesn't. I'd like to be able to pull the smart info for all the devices from all the hosts in a cluster.
Thanks
You could do something like this
ForEach-Object -Process {
$EsxCli = Get-EsxCli -VMHost $esx -V2
$esxcli.storage.core.device.list.Invoke() | Where {$_.ThinProvisioningStatus -eq "yes"} |
ForEach-Object -Process {
$dev = $_.device
$esxcli.storage.core.device.smart.get.Invoke(@{devicename = $dev}) |
Select @{N='VMHost';E={$esxcli.VMHost.Name}},
@{N='Device';E={$dev}},*
}
} | Out-GridView
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
When you place a variable between single quotes, there will be no substitution.
Place $device between double quotes.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Double quotes worked. Thanks LucD.
Would you mind helping me get this working? Like I said earlier, I'm trying to pull the smart info from every host in the cluster. The following snippet does work, but I'd like to add the hostname and NAA identifier to the list.
ForEach-Object -Process {
$EsxCli = Get-EsxCli -VMHost $esx -V2
($esxcli.storage.core.device.list.Invoke() | Where {$_.ThinProvisioningStatus -eq "yes"}) | Select Device |
ForEach-Object -Process {
$esxcli.storage.core.device.smart.get.Invoke(@{devicename = $_.device})
}
} | Out-GridView
You could do something like this
ForEach-Object -Process {
$EsxCli = Get-EsxCli -VMHost $esx -V2
$esxcli.storage.core.device.list.Invoke() | Where {$_.ThinProvisioningStatus -eq "yes"} |
ForEach-Object -Process {
$dev = $_.device
$esxcli.storage.core.device.smart.get.Invoke(@{devicename = $dev}) |
Select @{N='VMHost';E={$esxcli.VMHost.Name}},
@{N='Device';E={$dev}},*
}
} | Out-GridView
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference