Powershell Script help!
Hi,
Can anyone help out with a powershell script to perform 4 functions which are
1-enable powershell script to run on a remote machine
2-stop a service at logon in system context
3-change a registry entry
and
4-restart the same service.
I need to make sure a particulat service is stopped before changing the registry value then once the reg value is changed , to restart the same service.
Powershell is disabled by default on all machine in the environment
Thanks
Can anyone help out with a powershell script to perform 4 functions which are
1-enable powershell script to run on a remote machine
2-stop a service at logon in system context
3-change a registry entry
and
4-restart the same service.
I need to make sure a particulat service is stopped before changing the registry value then once the reg value is changed , to restart the same service.
Powershell is disabled by default on all machine in the environment
Thanks
0 Comments
[ + ] Show comments
Answers (8)
Please log in to answer
Posted by:
anonymous_9363
14 years ago
Seriously? You're asking the same question but in respect of a different scripting language? Do you REALLY want another post with LMGTFY links in it? Holy cow...you simply cannot be that lazy.
And BTW, *NO* script should *EVER* be just a three-liner because, if it is, it means [puts on drum to bang, starts blowing same old trumpet] that there's zero error-trapping. As such, it will work 99.99% of the time but you can guarantee that the 0.01% of the time when it fails, it will be at a time of maximum inconvenience to you and maximum exposure of you.
And BTW, *NO* script should *EVER* be just a three-liner because, if it is, it means [puts on drum to bang, starts blowing same old trumpet] that there's zero error-trapping. As such, it will work 99.99% of the time but you can guarantee that the 0.01% of the time when it fails, it will be at a time of maximum inconvenience to you and maximum exposure of you.
Posted by:
dunnpy
14 years ago
Ola,
The people in this forum want to help people with their issues and questions, but you really are not going to get help if you don't do the ground work yourself.
Ian (VBscab) is of great help to people here - look at his number of postings and score, they speak for themselves.
Your topic started as a powershell question, the answer to which you could have found out yourself with Google. Then you changed your mind and requested the same thing for VB script - again, you could Google the answer.
If you had done your homework and got the bones of a script that wasn't quite working right you would get all the help in the world with people offering modifications and different methods of acheiving the same goal.
Instead, the way you have come across is 'Can someone do my job for me?' - Can you see how it can be perceived as that?
Ian's not doing this to be nasty - he's prompting you to be technically better by challenging you to do some investigation, learn from what you find out there and come back with questions you really can't find the answer to.
Hope that clarifies things,
Dunnpy
The people in this forum want to help people with their issues and questions, but you really are not going to get help if you don't do the ground work yourself.
Ian (VBscab) is of great help to people here - look at his number of postings and score, they speak for themselves.
Your topic started as a powershell question, the answer to which you could have found out yourself with Google. Then you changed your mind and requested the same thing for VB script - again, you could Google the answer.
If you had done your homework and got the bones of a script that wasn't quite working right you would get all the help in the world with people offering modifications and different methods of acheiving the same goal.
Instead, the way you have come across is 'Can someone do my job for me?' - Can you see how it can be perceived as that?
Ian's not doing this to be nasty - he's prompting you to be technically better by challenging you to do some investigation, learn from what you find out there and come back with questions you really can't find the answer to.
Hope that clarifies things,
Dunnpy
Posted by:
anonymous_9363
14 years ago
http://www.lmgtfy.com/?q=powershell+stop+service+on+remote+computer
http://www.lmgtfy.com/?q=powershell+remote+registry+edit
To ensure a service has stopped, you need to check the service's status.
http://www.lmgtfy.com/?q=powershell+remote+service+status
http://www.lmgtfy.com/?q=powershell+remote+registry+edit
To ensure a service has stopped, you need to check the service's status.
http://www.lmgtfy.com/?q=powershell+remote+service+status
Posted by:
noodles187
14 years ago
Posted by:
dunnpy
14 years ago
Posted by:
noodles187
14 years ago
Hi Paul,
Thanks for the response but i don't intend installing powershell to the clients. I want to know how to convert the powershell script into a vbs file (as i'm more comfortable scripting in PS) then use the "cscript.vbs" command line in the sccm program to deploy the script to the clients.
Or rather, can someone give me examples of a vbscript to do the following
1-stop a service at logon in system context (on remote machines)
2-change a registry entry to point to a unc path (\\server1\directory1\file1)
and
3-restart the same service once the file's been updated.
I know this is just a three liner in PS, but as PS won't execute on machines without the engine, it'll be much easier to do it via vbs.
Thanks
Thanks for the response but i don't intend installing powershell to the clients. I want to know how to convert the powershell script into a vbs file (as i'm more comfortable scripting in PS) then use the "cscript.vbs" command line in the sccm program to deploy the script to the clients.
Or rather, can someone give me examples of a vbscript to do the following
1-stop a service at logon in system context (on remote machines)
2-change a registry entry to point to a unc path (\\server1\directory1\file1)
and
3-restart the same service once the file's been updated.
I know this is just a three liner in PS, but as PS won't execute on machines without the engine, it'll be much easier to do it via vbs.
Thanks
Posted by:
noodles187
14 years ago
Hi VBscab,
Thanks for the response and i'm sure you know this is a public forum where anyone can ask questions regardless of how easy the results are. Some people know these things but just dont know how to put it together so stop being a DH , you don't have to respond to posts that you feel are too simple.
Thanks for the response and i'm sure you know this is a public forum where anyone can ask questions regardless of how easy the results are. Some people know these things but just dont know how to put it together so stop being a DH , you don't have to respond to posts that you feel are too simple.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.