Hi,
i think th title is preaty clear. We have a vcenter versin 6.7 with host on esxi server 6.7.0.
i would like to plan a task to restart a service like ntp on all esx in this vcenter, i thnik yhere is 2 solutions :
- a script which connects to each esx and which launches a service restart command like
Connect-viserver vcenter1 -user root -pass password
$report = foreach($esx in Get-VMHost){
Restart-VMHostService -HostService ( $_ | Get-VMHostService | Where { $_.Key -eq "ntpd" } )
}
- or a planified task in vcenter but the option is not active i think because a can edit run a task but not add a task.
So
what is your opinion and the possibilities ?
Thank you
Options for vCenter Server task scheduling: Create a Scheduled Task
Using the vSphere Web Client?
Log In to vCenter Server by Using the vSphere Client
That's the vSphere Client.
The documentation I linked to refers to the vSphere Web Client:
Which you can launch like this:
HI,
thanks actually I can via sphere-client configure a scheduled task, but my goal was to plan a daily restart of the ntp service
and the option is : - create a new vm or - search new update
In which case you'll need some other type of task scheduler to run your custom script, something more generic such as the schedulers in Windows, Linux, or macOS.
correct i will re-direct my question in the powercli forum.
thank you for your help
If you want to achieve this via the PowerCLI, run the command like the following (for example for the SSH service):
Get-VMHost | Foreach {Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} )}
Moderator: Thread locked as a duplicate has now been created in the PowerCLI area.