Hi All,
I was trying to merge esxi SSH service start then following by other command in same script but unable to merge the same. Can someone good at powercli help me in creating such script.
The following activities should be done in script.
-> Start SSH service for esxi host (Specific Cluster in vCenter)
Then
-> esxcli sched swap system set -l false
then
-> esxcli system corefump file remove -F
Then stop the SSH service
the above 4 steps should be included in one script.
Thanks in Advance.
Using the PowerCLI Get-EsxCli cmdlet, you don't have to start and stop the SSH service. The following PowerCLI script is the equivalent of your code and runs on all of your hosts. The specify a specific cluster, you have to replace the * with the cluster name:
Get-Cluster -Name * | Get-VMHost | ForEach-Object {
$esxcli = Get-EsxCli -VMHost $_
$esxcli.sched.swap.system.set($null,$null,$null,$null,$null,$false,$null)
$esxcli.system.coredump.file.remove($null,$true)
}
Using the PowerCLI Get-EsxCli cmdlet, you don't have to start and stop the SSH service. The following PowerCLI script is the equivalent of your code and runs on all of your hosts. The specify a specific cluster, you have to replace the * with the cluster name:
Get-Cluster -Name * | Get-VMHost | ForEach-Object {
$esxcli = Get-EsxCli -VMHost $_
$esxcli.sched.swap.system.set($null,$null,$null,$null,$null,$false,$null)
$esxcli.system.coredump.file.remove($null,$true)
}
Thanks Mate,
Its working fine. however I made few changes based on my infra. Thanks