When you are troubleshooting an ESX host, you can see a lot off warnings in the VMKERNEL log:
Jan 29 16:15:34 esx02.ict-freak.local vmkernel: 9:23:45:33.917 cpu1:4210)WARNING: NMP: nmp_DeviceAttemptFailover:
Retry world failover device “t10.9454450000000000000000001000000056900000D0000000” – issuing command 0x4100041f0c00
But which datastore belongs to the Canonical name mentioned in the VMKERNEL log??
The following script will return the Datastore name. Thanks @Lucd22 for the help!!
$esxhost = "esx1.ict-freak.local" $id = "t10.9454450000000000000000001000000056900000D0000000" foreach($ds in (Get-VMHost $esxhost | ` Get-Datastore | where{$_.Type -eq "vmfs"} | Get-View)){ $ds.Info.Vmfs.Extent | %{ if($_.DiskName -eq $id){ Write-Host $ds.Info.Name $_.DiskName } } }
The output will look like this:
Ok, this is a nice script to have in you toolbox, but I hear you think, how do I add it to the VESI?.
First you need to create a new folder, if you don’t use any other Powerpack.
Give the folder a name. I used the name Personal scripts:
The next step is to add a new script node:
The last step is to paste the following code into the new created script node:
if ($global:defaultviservers) { $id = Read-Host "Enter the Canonical Name (naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)" foreach($esx in (Get-VMHost)){ foreach($ds in (Get-VMHost $esx | Get-Datastore | ` where{$_.Type -eq "vmfs"} | Get-View)){ $Details = "" |Select-Object DataStore $ds.Info.Vmfs.Extent | %{ if($_.DiskName -eq $id){ $Details.DataStore = $ds.Info.Name } } } $Details.PSTypeNames.Clear() $Details } } Else { [System.Windows.Forms.MessageBox]::Show('You must connect to one or more hosts before you can use this node. Please click on the ''Managed Hosts'' node of the VMware PowerPack, connect to one or more of the servers you have configured there, and then try again.','Connection not established',[System.Windows.Forms.MessageBoxButtons]::OK,[System.Windows.Forms.MessageBoxIcon]::Information) | Out-Null }
If you want to run this script, you have to connect to vCenter first. Open VMware – Managed Hosts:
Click on Add managed host… to add a server:
To connect to the new added vCenter server, press the connect under actions. To run the script click on the new create script node and enter a Canonical Name.
And the script will return the Datastore name:
Now you are able to convert the Canonical name to the Datastore Name.
Your script for the VESI is wrong. You need to move the $Details output up two brackets to be in the same loop as the foreach $ds.