powershell - Algorithm to divide server reboots to once a week -
Adding functionality to a script is that I am setting a variable number of servers in a citrix form and then doing the setting I've been rebooting them only once a week. So if there are 2 servers, they will be set to reboot on Saturdays and Sundays. If there is 7, then it will go through the week. If it is 10, then it will set 2 to reboot in 3 days, in the rest of 1 week. Just looking for a basic algorithm that my colleagues and thinkers think and come up with very complex logic.
Like this?
$ server = 1..10 |% {"server $ _"} $ server | Reboot ($ i ++% 7)) at "Foreach {$ $ ($ Day + W3)"} 1 reboot on Sunday server 2 reboot on Monday server 3 Tuesday server 4 reboot server5 reboot on server 5 reboot on server server 5 reboot on Friday Reboot on Server Server 6 Reboot Server 7 Reboot on Saturday Server 8 on Sunday Server 9 Reboot on Monday Server 10 on
Comments
Post a Comment