Hi,
I used to use this script to change the PSP on our productions LUNs presented to ESXi 4.1 hosts but it no longer works on ESXi5. I was able to find the command to run on a single host while connect via ssh but I have 10+ LUNs to change on at least 20 or more hosts. I'd like to script it.
I have limited experience with scripting so any help would be tremendously appreciated.
Luc
----------------------------------------------------------------------------------------------------------------------
Connect-VISERVER -Server hpc05b14
$esxcli = Get-EsxCli -Server hpc05b14
$esxcli.storage.nmp.device.set($null,"naa.60060e80058dca0000008dca00002110", "VMW_PSP_RR")
Disconnect-VISERVER
----------------------------------------------------------------------------------------------------------------------
I receive the following error;
Get-EsxCli : 07/02/2012 2:47:23 PM Get-EsxCli The method or operation is not implemented.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\MyScripts\uspvm.ps1:3 char:21
+ $esxcli = Get-EsxCli <<<< -Server hpc05b14.ic.gc.ca
+ CategoryInfo : NotSpecified: (:) [Get-EsxCli], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Com
mands.GetEsxCli
You cannot call a method on a null-valued expression.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\MyScripts\uspvm.ps1:4 char:31
+ $esxcli.storage.nmp.device.set <<<< ($null,"naa.60060e80058dca0000008dca00002110", "VMW_PSP_RR")
+ CategoryInfo : InvalidOperation: (set:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Is serve hpc05b14 a vCenter or an ESXi server ?
If it is an ESXi host can you try with the VMHost parameter instead of the Server parameter ?
$esxcli = Get-EsxCli -VMHost hpc05b14
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It's an ESXi host. Using the -VMHost parameter worked for this LUN but I tried another LUN to make sure my script really worked but now I get the following error;
The remote server returned an error: (500) Internal Server Error.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\MyScripts\uspvm.ps1:4 char:31
+ $esxcli.storage.nmp.device.set <<<< ($null,"(naa.60060e80058dca0000008dca00002112", "VMW_PSP_RR")
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodInvocationException
Merci
Thanks Luc!
Never mind my last post, I made a mistake when I copied the LUN id.