as a newcomer in the forum and in powershell script as well i need a really simple help to write a code. By a .txt or .csv files i would to import a list of servers to reboot in a particular moment of the day. Example, i need to reboot 10 servers (previously listed in the files) at 22.00 h just once. Can somebody can advice me how to proceed? Thank you in advance.
The forum is to assist with code issues you are having, not write scripts for you. Would recommend that you search for a script as restarting servers from a list is a very common ask. For the time, you would just schedule a task to execute the script at the required time.
Hi rob, yes of course a script has been already written i was just waiting an initial input to go ahead.
What i did is really simple, but to complete the whole process i need to introduce the timing and i found some obstacle to ending the script:
$Servers = get-content “D:\WRP\Reboot\Servers.txt”
Restart-Computer -ComputerName $Servers -force -wait
The logic is clear, i create a text file with a list of servers to reboot. Now i would add a cycle to perform the reboot in a specific moment of the day.
I would just put your code in a scheduled task, assuming it’s the same time interval