Restarting an AOS in AX 2009 and 2012 is easy. Depending on the topology in D365, that can also be easy. However, performing the same action with Dynamics 365 For Finance and Operations on-premise isn't quite as easy because the service fabric is there. You have to ask the service fabric to restart the service rather just restart a windows based service. Here is the powershell that can restart the AXService.exe services for you which is, in simple terms, restarting the AOS.