Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

Script to Restart Computer?


  • Please log in to reply
7 replies to this topic

#1 rob_5000x1

rob_5000x1

  •  Avatar image
  • Members
  • 2 posts
  • OFFLINE
  •  

Posted 05 January 2022 - 12:18 PM

Hi I'm new here and apologies if I posted this question in the wrong place.

 

I'm looking for a script for Syncro to restart a computer at 10am every Sunday, anyone have a script for that?


Edited by hamluis, 05 January 2022 - 01:13 PM.
Moved from Bus Apps to Programming - Hamluis.


BC AdBot (Login to Remove)

 


#2 Vision123

Vision123

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Lebanon
  • Local time:10:49 PM

Posted 05 January 2022 - 12:34 PM

Hello rob you're using windows ?



#3 null__

null__

  •  Avatar image
  • Members
  • 195 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:03:49 PM

Posted 05 January 2022 - 02:00 PM

What about setting up a scheduled task to do that?



#4 Vision123

Vision123

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Lebanon
  • Local time:10:49 PM

Posted 05 January 2022 - 02:04 PM

What about setting up a scheduled task to do that?

 

Indeed that's the reason why i asked if hes using windows OS, Task Scheduler would do the job !!



#5 null__

null__

  •  Avatar image
  • Members
  • 195 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:03:49 PM

Posted 05 January 2022 - 03:49 PM

 

What about setting up a scheduled task to do that?

 

Indeed that's the reason why i asked if hes using windows OS, Task Scheduler would do the job !!

 

I assumed that's why you were asking.

 

You wouldn't even necessarily have to do a .bat file within the task scheduled. You can type shutdown as the command as -r as the argument and save it.



#6 rob_5000x1

rob_5000x1
  • Topic Starter

  •  Avatar image
  • Members
  • 2 posts
  • OFFLINE
  •  

Posted 05 January 2022 - 03:55 PM

Thank you for the replies! I am using Windows but I'm trying to do the command remotely



#7 JohnnyJammer

JohnnyJammer

  •  Avatar image
  • Members
  • 1,268 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:06:49 AM

Posted 08 January 2022 - 04:15 AM

Populate the computers in a domain using (dsquery computer "OU" -scope subtree -limit 10000 -o rdn | sort >> C:\ListOfCompuytersToReboot.txt.

Or, fill the text file with the hostnames (Computer names)

@echo off
FOR /F "delims=" %%a IN (C:\ListOfCompuytersToReboot.txt) DO (
    wmic /node:"%%a" process call create "shutdown -s -t 30"
    Shutting Down: %%a
    )
pause

Edited by JohnnyJammer, 08 January 2022 - 04:16 AM.


#8 sflatechguy

sflatechguy

  •  Avatar image
  • BC Advisor
  • 2,770 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:49 PM

Posted 08 January 2022 - 03:14 PM

Or use PowerShell.

 

Restart-Computer <computername>

 

 

You can supply a list of computer names in a file and run a foreach loop over the file.

 

foreach ( $computername in $filename )

 

{

     Restart-Computer <computername>

}






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users