AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 01.11.2011, 03:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
Two tricks about stopping AX service via PowerShell
Источник: http://alexvoy.blogspot.com/2011/10/...x-service.html
==============

Generally speaking, it is true for all Windows services but my particular example is about stopping Microsoft Dynamics AX service (AOS) via PowerShell.

As recommended in Deploying customizations across Microsoft Dynamics AX environments white paper, before importing a metadata model store into the target environment, one must stop all AOS instances in it.

First trick is on how to provide the correct name of the service supposed to be stopped.



If you try to use the service name you see in Services, you will fail.
PS C:\Windows\system> Set-Service -name AOS60$01 -status stopped
Set-Service : Service AOS60 was not found on computer '.'.
At line:1 char:12
+ Set-Service -name AOS60$01 -status stopped + CategoryInfo : ObjectNotFound: (.:String) [Set-Service], Invali dOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C ommands.SetServiceCommand
It is evident that the problem is in $ sign. To fix it you can simply quoted it with "'" (not with "!).
PS C:\Windows\system32> Set-Service -name 'AOS60$01' -status stopped
Unfortunately, this command does not work anyway because of an error:
Set-Service : Cannot stop service 'Microsoft Dynamics AX Object Server 6.0$01-a
x2012_std (AOS60$01)' because it is dependent on other services.
At line:1 char:12
+ Set-Service -name 'AOS60$01' -status stopped + CategoryInfo : InvalidOperation: (System.ServiceProcess.Service Controller:ServiceController) [Set-Service], ServiceCommandException + FullyQualifiedErrorId : ServiceIsDependentOnNoForce,Microsoft.PowerShell .Commands.SetServiceCommand
Nevertheless, you can stop the service as usual without any issue. I do not why it does not work but I would suggest that one use another commands to stop and start the service, namely:
PS C:\Windows\system32> Stop-Service 'AOS60$01'
WARNING: Waiting for service 'Microsoft Dynamics AX Object Server
6.0$01-ax2012_std (AOS60$01)' to finish stopping...
PS C:\Windows\system32> Start-Service 'AOS60$01'
WARNING: Waiting for service 'Microsoft Dynamics AX Object Server
6.0$01-ax2012_std (AOS60$01)' to finish starting...
It takes its time, be patient!







Источник: http://alexvoy.blogspot.com/2011/10/...x-service.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Теги
powershell

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
DynamicsAxSCM: Service products in Microsoft Dynamics AX 2012 Blog bot DAX Blogs 2 02.06.2011 13:36
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 01:07.