I’ve built scripts that just do a simple restart or stop/start action, but my question is can i do a script that i can run from my desktop that will restart a service remotely on another machine. I’m guessing there’s a way just dont know what to add to the script.<\/p>","upvoteCount":7,"answerCount":22,"datePublished":"2014-08-27T18:49:14.000Z","author":{"@type":"Person","name":"jbleich","url":"https://community.spiceworks.com/u/jbleich"},"acceptedAnswer":{"@type":"Answer","text":"
yes.<\/p>\n
sc \\machine stop <\/p>","upvoteCount":4,"datePublished":"2014-08-27T18:53:30.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/2","author":{"@type":"Person","name":"williamrichard8995","url":"https://community.spiceworks.com/u/williamrichard8995"}},"suggestedAnswer":[{"@type":"Answer","text":"
I’ve built scripts that just do a simple restart or stop/start action, but my question is can i do a script that i can run from my desktop that will restart a service remotely on another machine. I’m guessing there’s a way just dont know what to add to the script.<\/p>","upvoteCount":7,"datePublished":"2014-08-27T18:49:15.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/1","author":{"@type":"Person","name":"jbleich","url":"https://community.spiceworks.com/u/jbleich"}},{"@type":"Answer","text":"
Have you taken a look at Spiceworks troubleshooting feature? It allows you to view hardware states, services, and processes.<\/p>","upvoteCount":0,"datePublished":"2014-08-27T18:54:14.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/3","author":{"@type":"Person","name":"codyroche","url":"https://community.spiceworks.com/u/codyroche"}},{"@type":"Answer","text":"
also via powershell:<\/p>\n
get-service -computername YOURSERVER -displayname \"Spiceworks\" | start-service\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2014-08-27T18:54:42.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/4","author":{"@type":"Person","name":"Rob-Dunn","url":"https://community.spiceworks.com/u/Rob-Dunn"}},{"@type":"Answer","text":"yes, use Powershell remoting like:<\/p>\n
Invoke-Command -ComputerName RemoteComputerName { Restart-Service -Name Spooler -Force }\n<\/code><\/pre>\nThe remote computer must be running WinRM, and you must have sufficient permissions. Windows 8 and above and Server 2012 and above come with WinRM by default.<\/p>","upvoteCount":0,"datePublished":"2014-08-27T18:55:15.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/5","author":{"@type":"Person","name":"samboutros","url":"https://community.spiceworks.com/u/samboutros"}},{"@type":"Answer","text":"
and from powershell:<\/p>\n
Get-Service -Name bits -ComputerName RSLAPTOP01 | Set-Service -Status Running<\/p>","upvoteCount":0,"datePublished":"2014-08-27T18:55:34.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/6","author":{"@type":"Person","name":"williamrichard8995","url":"https://community.spiceworks.com/u/williamrichard8995"}},{"@type":"Answer","text":"
Or use the services snap in to restart them on the remote computer<\/p>","upvoteCount":1,"datePublished":"2014-08-27T18:56:50.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/7","author":{"@type":"Person","name":"rockn","url":"https://community.spiceworks.com/u/rockn"}},{"@type":"Answer","text":"
Yes you can do that. You will have to do a remote admin privilege and then connect to the computer using powershell then do the stop, start or restart as needed.<\/p>","upvoteCount":0,"datePublished":"2014-08-27T19:02:04.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/8","author":{"@type":"Person","name":"johnbeard9701","url":"https://community.spiceworks.com/u/johnbeard9701"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Sam Boutros:<\/div>\n
\nyes, use Powershell remoting like:<\/p>\n
Invoke-Command -ComputerName RemoteComputerName { Restart-Service -Name Spooler -Force }\n<\/code><\/pre>\nThe remote computer must be running WinRM, and you must have sufficient permissions. Windows 8 and above and Server 2012 and above come with WinRM by default.<\/p>\n<\/blockquote>\n<\/aside>\n
And psremoting needs to be enabled - is psremoting enabled by default? I know winRM is installed, but enabled?<\/p>","upvoteCount":0,"datePublished":"2014-08-27T19:03:06.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/9","author":{"@type":"Person","name":"Rob-Dunn","url":"https://community.spiceworks.com/u/Rob-Dunn"}},{"@type":"Answer","text":"\n\n
<\/div>\n
William Richard:<\/div>\n
\nyes.<\/p>\n
sc \\machine stop <\/p>\n<\/blockquote>\n<\/aside>\n
Thanks for all the PS replies guys but i do prefer bat files for some reason.<\/p>\n
So if i just do a restart insteadof stop? or do I have to do a stop, pause, start?<\/p>","upvoteCount":1,"datePublished":"2014-08-27T19:04:18.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/10","author":{"@type":"Person","name":"jbleich","url":"https://community.spiceworks.com/u/jbleich"}},{"@type":"Answer","text":"
stop then start = restart<\/p>","upvoteCount":0,"datePublished":"2014-08-27T19:05:33.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/11","author":{"@type":"Person","name":"williamrichard8995","url":"https://community.spiceworks.com/u/williamrichard8995"}},{"@type":"Answer","text":"
Seriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.<\/p>","upvoteCount":2,"datePublished":"2014-08-27T19:06:17.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/12","author":{"@type":"Person","name":"Rob-Dunn","url":"https://community.spiceworks.com/u/Rob-Dunn"}},{"@type":"Answer","text":"\n\n
<\/div>\n
William Richard:<\/div>\n
\nstop then start = restart<\/p>\n<\/blockquote>\n<\/aside>\n
Restart didnt work…I’ll try again.<\/p>","upvoteCount":0,"datePublished":"2014-08-27T19:07:06.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/13","author":{"@type":"Person","name":"jbleich","url":"https://community.spiceworks.com/u/jbleich"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Rob Dunn:<\/div>\n
\nSeriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.<\/p>\n<\/blockquote>\n<\/aside>\n
I use PS for more complex stuff but for simple stuff like this i just prefer batch files, less problems usually.<\/p>\n
And no troubles w/ the job market bud, I’m doing just fine <\/p>","upvoteCount":2,"datePublished":"2014-08-27T19:07:55.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/14","author":{"@type":"Person","name":"jbleich","url":"https://community.spiceworks.com/u/jbleich"}},{"@type":"Answer","text":"
sc \\machinename service stop<\/p>\n
sc \\machinename service start<\/p>\n
<\/p>","upvoteCount":1,"datePublished":"2014-08-27T19:08:09.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/15","author":{"@type":"Person","name":"williamrichard8995","url":"https://community.spiceworks.com/u/williamrichard8995"}},{"@type":"Answer","text":"
sc \\machine stop<\/p>","upvoteCount":0,"datePublished":"2014-08-27T19:08:19.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/16","author":{"@type":"Person","name":"Rob-Dunn","url":"https://community.spiceworks.com/u/Rob-Dunn"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Justin_Bleich:<\/div>\n
\n\n\n
<\/div>\n
Rob Dunn:<\/div>\n
\nSeriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.<\/p>\n<\/blockquote>\n<\/aside>\n
I use PS for more complex stuff but for simple stuff like this i just prefer batch files, less problems usually.<\/p>\n
And no troubles w/ the job market bud, I’m doing just fine <\/p>\n<\/blockquote>\n<\/aside>\n
Ha! So says everyone. I didn’t mean to make an assumption, but just saying - - - you might change your mind about your job in the future. I know I did.<\/p>","upvoteCount":1,"datePublished":"2014-08-27T19:09:05.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/17","author":{"@type":"Person","name":"Rob-Dunn","url":"https://community.spiceworks.com/u/Rob-Dunn"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Rob Dunn:<\/div>\n
\n\n\n
<\/div>\n
Justin_Bleich:<\/div>\n
\n\n\n
<\/div>\n
Rob Dunn:<\/div>\n
\nSeriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.<\/p>\n<\/blockquote>\n<\/aside>\n
I use PS for more complex stuff but for simple stuff like this i just prefer batch files, less problems usually.<\/p>\n
And no troubles w/ the job market bud, I’m doing just fine <\/p>\n<\/blockquote>\n<\/aside>\n
Ha! So says everyone. I didn’t mean to make an assumption, but just saying - - - you might change your mind about your job in the future. I know I did.<\/p>\n<\/blockquote>\n<\/aside>\n
I hear you man, you’re always happy till you’re not LOL<\/p>\n
I do enjoy powershell, and again use it for some more complex stuff, I wouldnt call myself a PS expert by any means, but I do still like bat for the small stuff.<\/p>","upvoteCount":1,"datePublished":"2014-08-27T19:13:30.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/18","author":{"@type":"Person","name":"jbleich","url":"https://community.spiceworks.com/u/jbleich"}},{"@type":"Answer","text":"
You can also do this in Spiceworks<\/p>","upvoteCount":0,"datePublished":"2014-08-27T19:23:28.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/19","author":{"@type":"Person","name":"rockn","url":"https://community.spiceworks.com/u/rockn"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Justin_Bleich:<\/div>\n
\n\n\n
<\/div>\n
Rob Dunn:<\/div>\n
\n\n\n
<\/div>\n
Justin_Bleich:<\/div>\n
\n\n\n
<\/div>\n
Rob Dunn:<\/div>\n
\nSeriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.<\/p>\n<\/blockquote>\n<\/aside>\n
I use PS for more complex stuff but for simple stuff like this i just prefer batch files, less problems usually.<\/p>\n
And no troubles w/ the job market bud, I’m doing just fine <\/p>\n<\/blockquote>\n<\/aside>\n
Ha! So says everyone. I didn’t mean to make an assumption, but just saying - - - you might change your mind about your job in the future. I know I did.<\/p>\n<\/blockquote>\n<\/aside>\n
I hear you man, you’re always happy till you’re not LOL<\/p>\n
I do enjoy powershell, and again use it for some more complex stuff, I wouldnt call myself a PS expert by any means, but I do still like bat for the small stuff.<\/p>\n<\/blockquote>\n<\/aside>\n
If you want to see PS happiness, come to SpiceWorld 2014 and attend Robs session! I learn something new every year from this guy!<\/p>","upvoteCount":0,"datePublished":"2014-08-27T20:03:17.000Z","url":"https://community.spiceworks.com/t/can-you-remotely-restart-a-service-on-a-server/334092/20","author":{"@type":"Person","name":"bobbeatty","url":"https://community.spiceworks.com/u/bobbeatty"}}]}}
jbleich
(Justin_Bleich)
August 27, 2014, 6:49pm
1
I’ve built scripts that just do a simple restart or stop/start action, but my question is can i do a script that i can run from my desktop that will restart a service remotely on another machine. I’m guessing there’s a way just dont know what to add to the script.
7 Spice ups
Have you taken a look at Spiceworks troubleshooting feature? It allows you to view hardware states, services, and processes.
Rob-Dunn
(Rob Dunn)
August 27, 2014, 6:54pm
4
also via powershell:
get-service -computername YOURSERVER -displayname "Spiceworks" | start-service
1 Spice up
samboutros
(Sam Boutros)
August 27, 2014, 6:55pm
5
yes, use Powershell remoting like:
Invoke-Command -ComputerName RemoteComputerName { Restart-Service -Name Spooler -Force }
The remote computer must be running WinRM, and you must have sufficient permissions. Windows 8 and above and Server 2012 and above come with WinRM by default.
and from powershell:
Get-Service -Name bits -ComputerName RSLAPTOP01 | Set-Service -Status Running
rockn
(Rockn)
August 27, 2014, 6:56pm
7
Or use the services snap in to restart them on the remote computer
1 Spice up
Yes you can do that. You will have to do a remote admin privilege and then connect to the computer using powershell then do the stop, start or restart as needed.
Rob-Dunn
(Rob Dunn)
August 27, 2014, 7:03pm
9
Sam Boutros:
yes, use Powershell remoting like:
Invoke-Command -ComputerName RemoteComputerName { Restart-Service -Name Spooler -Force }
The remote computer must be running WinRM, and you must have sufficient permissions. Windows 8 and above and Server 2012 and above come with WinRM by default.
And psremoting needs to be enabled - is psremoting enabled by default? I know winRM is installed, but enabled?
jbleich
(Justin_Bleich)
August 27, 2014, 7:04pm
10
William Richard:
yes.
sc \machine stop
Thanks for all the PS replies guys but i do prefer bat files for some reason.
So if i just do a restart insteadof stop? or do I have to do a stop, pause, start?
1 Spice up
stop then start = restart
Rob-Dunn
(Rob Dunn)
August 27, 2014, 7:06pm
12
Seriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.
2 Spice ups
jbleich
(Justin_Bleich)
August 27, 2014, 7:07pm
13
Restart didnt work…I’ll try again.
jbleich
(Justin_Bleich)
August 27, 2014, 7:07pm
14
Rob Dunn:
Seriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.
I use PS for more complex stuff but for simple stuff like this i just prefer batch files, less problems usually.
And no troubles w/ the job market bud, I’m doing just fine
2 Spice ups
sc \machinename service stop
sc \machinename service start
1 Spice up
Rob-Dunn
(Rob Dunn)
August 27, 2014, 7:08pm
16
Rob-Dunn
(Rob Dunn)
August 27, 2014, 7:09pm
17
Justin_Bleich:
Rob Dunn:
Seriously, you need to step away from batch files. That is the way of the past, and honestly, if you don’t know PS, you’ll have a hard time in the job market for Windows admin roles.
I use PS for more complex stuff but for simple stuff like this i just prefer batch files, less problems usually.
And no troubles w/ the job market bud, I’m doing just fine
Ha! So says everyone. I didn’t mean to make an assumption, but just saying - - - you might change your mind about your job in the future. I know I did.
1 Spice up
jbleich
(Justin_Bleich)
August 27, 2014, 7:13pm
18
I hear you man, you’re always happy till you’re not LOL
I do enjoy powershell, and again use it for some more complex stuff, I wouldnt call myself a PS expert by any means, but I do still like bat for the small stuff.
1 Spice up
rockn
(Rockn)
August 27, 2014, 7:23pm
19
You can also do this in Spiceworks
bobbeatty
(Bob Beatty)
August 27, 2014, 8:03pm
20
Justin_Bleich:
I hear you man, you’re always happy till you’re not LOL
I do enjoy powershell, and again use it for some more complex stuff, I wouldnt call myself a PS expert by any means, but I do still like bat for the small stuff.
If you want to see PS happiness, come to SpiceWorld 2014 and attend Robs session! I learn something new every year from this guy!