$vCenter = Read-host -prompt "Enter the vCenter hostname"
connect-viserver -server $vCenter -Credential (Get-Credential)
$cluster=read-host -prompt "Enter the cluster Name"
$naa.id=read-host -prompt "Enter the naa id"
Get-cluster -Name "$cluster" | Get-VMHost | Get-ScsiLun -canonicalName "$naa.id" | Set-ScsiLun -MultipathPolicy "roundrobin"
=============================================
In the above script is used to change the datastore Multipath policy to RoundRobin. When we execute the script it prompts for vCenter FQDN,credentials,Cluster Name and naa.id of the datastore.
But i get the below error message.
=============================================================
Property 'id' cannot be found on this object; make sure it exists and is settab
le.
At C:\users\cz3m7g\desktop\RR.ps1:4 char:6
+ $naa. <<<< id=read-host -prompt "Enter the naa id"
+ CategoryInfo : InvalidOperation: (id:String) [], RuntimeExcepti
on
+ FullyQualifiedErrorId : PropertyNotFound
Get-ScsiLun : 2/8/2013 2:41:48 AM Get-ScsiLun Could not find ScsiLunI
nterop with CanonicalName '.id'.
At C:\users\cz3m7g\desktop\RR.ps1:5 char:56
+ Get-cluster -Name "$cluster" | Get-VMHost | Get-ScsiLun <<<< -canonicalName
"$naa.id" | Set-ScsiLun -MultipathPolicy "roundrobin"
+ CategoryInfo : ObjectNotFound: (.id:String) [Get-ScsiLun], VimE
xception
+ FullyQualifiedErrorId : Common_CommonUtil_FilterCollection_ObjectNotFoun
d,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetScsiLun
Get-ScsiLun : 2/8/2013 2:41:49 AM Get-ScsiLun Value cannot be null.
Parameter name: moRef
At C:\users\cz3m7g\desktop\RR.ps1:5 char:56
+ Get-cluster -Name "$cluster" | Get-VMHost | Get-ScsiLun <<<< -canonicalName
"$naa.id" | Set-ScsiLun -MultipathPolicy "roundrobin"
+ CategoryInfo : NotSpecified: (:) [Get-ScsiLun], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Host.GetScsiLun