Hello Lucd
Thanks for your reply.
I tried this script and getting below error please review and suggest the changes.
Though it is saying that password has been changed successfully but it is not changing
Get-View : Cannot validate argument on parameter 'Id'. The argument is null or
empty. Supply an argument that is not null or empty and then try the command ag
ain.
At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\root-passwor
d.ps1:27 char:26
+ $acctMgr = Get-View -Id <<<< $si.content.accountManager
+ CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingVal
idationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
You cannot call a method on a null-valued expression.
At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\root-passwor
d.ps1:28 char:22
+ $acctMgr.UpdateUser <<<< ($rootaccount)
+ CategoryInfo : InvalidOperation: (UpdateUser:String) [], Runtim
eException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Root password successfully changed on 192.168.20.87
Disconnect-VIServer : 5/16/2013 4:42:06 PM Disconnect-VIServer PowerC
LI is currently connected to more than one servers. Specify which server you wa
nt to disconnect or use the "*" wildcard to disconnect all.
At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\root-passwor
d.ps1:30 char:22
+ Disconnect-VIServer <<<< -Confirm:$False | Out-Null
+ CategoryInfo : InvalidOperation: (:) [Disconnect-VIServer], Vim
Exception
+ FullyQualifiedErrorId : Core_DisconnectVIServer_ServerNotSpecified,VMwar
e.VimAutomation.ViCore.Cmdlets.Commands.DisconnectVIServer