Services Script

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Brad Feath Brad Feath 3 months, 3 weeks ago.

  • Author
    Posts
  • #62958
    Profile photo of Brad Feath
    Brad Feath
    Participant

    Howdy guys!

    Hope you are all doing well. I have a question about services. I have this set of condition below and I was able to do number 1 but having difficulties with 2-4. Sorry just starting out, trying to practice just started college and have a few assignments 🙁

    1. If any or all of the services that start with letter “W” are running, stop them

    2. If confirm that all the services are stopped, reboot the computer

    3. Verify if the computer successfully reboot

    4. Verify if all the services are running after reboot

    Thanks for your help!

  • #62959
    Profile photo of BlackBoxCoder
    BlackBoxCoder
    Participant

    Hi, I dont want you to provide full code-blocks. But I can give you some Informations where you can have to go deeper.

    2. Get the Status of the Services, three hints: Get-Service, Status, Where
    3. Grab the Last boot time from an CIM-Instanc, two hints: Get-CimInstance, LastBootUptime
    4. Do the same like in step 2

    Hope, that will help you out.
    If you have some code, we can go further with this, but some of the task you have to do 🙂

    BR,
    BBC

  • #62977
    Profile photo of Brad Feath
    Brad Feath
    Participant

    Thanks BLackbox let me get on with it then! 🙂

    Will get back once I have constructed the code.

You must be logged in to reply to this topic.