Compare and start services after server restart

Answered Compare and start services after server restart

  • Thursday, December 13, 2012 11:40 AM
     
     

    Hello Guys, I need your help

    I need a simple script or two scripts. The script should do what I exactly need:

    1. Save all run services before server restart to file (net start>1.txt)

    2. Shutdown force and restart server

    3. After restart save all services to another file

    4. Compare services files and run all services  that not started after rebooting

    I don't know is that possibility to do it on one script If not I can do 1 and 2 step manually.

    Maybe is a chance to do it on many servers in one domain at once? It would be great.

    For example

    1. I have server host names list in txt file

    2. Save all services to txt file (run net start>1.txt) for all servers from txt file (or create a separate file for each server)

    after reboot

    3. Run net start>2.txt for all servers

    4. Compare services before and after reboot on all servers from txt host names file

    5. Run services what are not running after restart

    Right now I do it all manually, is any chance to autamatize it?

    Many thx for any help

All Replies

  • Thursday, December 13, 2012 11:46 AM
    Moderator
     
     
    Did you have a particular scripting language in mind you want to write this in?

    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Thursday, December 13, 2012 2:12 PM
     
     
    Nope, is any chance to do it in VBScript? :)
  • Thursday, December 13, 2012 2:17 PM
    Moderator
     
     

    I'm sure it can be done in VBScript.  Unfortunately, I don't write VBS, but maybe someone who does can help you write that.  There may be a considerable emphasis on the "you write that" part.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Monday, December 31, 2012 6:45 PM
    Moderator
     
     Answered
    Right now I do it all manually, is any chance to autamatize it?

    There are ways this can be automated with a script, but as mjolinor said, you'll have to write it yourself. This is not a free code-dispensing service. If you are writing your script and you get stuck at a specific spot, feel free to ask for help. In general, it helps to post the absolute minimum amount of code needed to reproduce the problem, as well as any error messages you receive.

    Bill