Hello,
I am new to scripting world.
Is there anyway I can use the powercli commands in powershell?
I was trying to add welcome note for an ESXi host via powershell by the below commands. And I am struggling for that. Can someone please help me how to do it via powershell (not via putty)
$esxcli = Get-EsxCli -VMhost <ESXi host name> -V2
$esxcli.system.settings.advanced.welcomemsg.get()
$esxcli.system.settings.advanced.welcomemsg.set('Hi')
This is what I am getting:
When you use the V2 switch, you have to use the Invoke() method
The parameters are passed in a hash table (for which you can get a template with the CreateArgs() method)
$esxcli = Get-EsxCli -VMhost <ESXi host name> -V2
$esxcli.system.welcomemsg.get.Invoke()
$esxcli.system.welcomemsg.set.Invoke(@{message='Hi'})
.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
When you use the V2 switch, you have to use the Invoke() method
The parameters are passed in a hash table (for which you can get a template with the CreateArgs() method)
$esxcli = Get-EsxCli -VMhost <ESXi host name> -V2
$esxcli.system.welcomemsg.get.Invoke()
$esxcli.system.welcomemsg.set.Invoke(@{message='Hi'})
.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That works. Thank you very much. You the BEST!