Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Using Powershell to script the restart of two Microsoft Dynamics AX services if either of them has stopped

$
0
0

I need some help writing a Powershell script to restart two services if either of them isn't running.  The script needs to include logic to stop a process if the service doesn't stop within 10 minutes and needs to use sleep timers to wait for services to stop and then idle after both are stopped.  See details below:

Any help would be greatly appreciated especially since I'm a newbie with using Powershell. 

  • Dynamics AX Object Server
         5.0$01-DynamicsAX-Prod-PB-01
  • Dynamics AX Object Server
         5.0$02-DynamicsAX-Prod-PB-02

    1.  If ANY of the services are
         not running, execute the following procedure to restart ALL of the
         services.

    1. Stop all the AOS services using NT service account “******” on servers. 
       
      1. Dynamics AX Object Server
               AX Object Server 5.0$01-DynamicsAX-Prod-PB-01
      2. Dynamics AX Object Server
               5.0$02-DynamicsAX-Prod-PB-02

        Note: These services can sometimes take several minutes to stop.
         If the service does not stop after 10 minutes, use Task Manager to
        terminate the “Ax32Serv.exe” processes.


  1. Leave all
         AOS services in a stopped status for 5 minutes.
  2. Start all the AOS services
         using NT service account “******” in servers 

    1. Dynamics
            AX Object Server 5.0$01-DynamicsAX-Prod-PB-01
    2. Dynamics AX Object Server
            5.0$02-DynamicsAX-Prod-PB-02


 





Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>