다음을 통해 공유


Administering Microsoft Dynamics AX by using Windows PowerShell

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Windows PowerShell is a command-line scripting tool that lets administrators interact directly with Microsoft Dynamics AX to add users and user authentication, manage models, and manage configurations for communication between Microsoft Dynamics AX and Microsoft SQL Server Reporting Services. In addition, administrators can use Windows PowerShell cmdlets to create scripts. This term is pronounced "command-lets." For information about cmdlets available for Microsoft Dynamics AX, see Windows PowerShell for Microsoft Dynamics AX.

When you install Microsoft Dynamics AX, Windows PowerShell 2.0 is installed if it is not already present. By default, Windows PowerShell is located in the following location: <%SystemRoot%>\System32\WindowsPowerShell\v1.0\PowerShell.exe.

Note

Windows PowerShell 2.0 is installed in the v1.0 folder, because it is backward compatible with Windows PowerShell 1.0.

For a list of the new features in Windows PowerShell 2.0, see About Windows PowerShell 2.0.

Important

The Remote Registry service must be started in your environment on the server that is running the Microsoft Dynamics AX databases.

Accessing Windows PowerShell for Microsoft Dynamics AX

After you install Microsoft Dynamics AX, the applicable Windows PowerShell cmdlets are available from either the Microsoft Dynamics AX Management Shell or the Windows PowerShell console. By using the Management Shell, you can manage many aspects of Microsoft Dynamics AX. For example, you can add users and user authentication, manage models, and manage configurations for communication between Microsoft Dynamics AX and Reporting Services. The cmdlets that are run from the Management Shell output Microsoft Dynamics AX objects that are based on the Microsoft .NET Framework. These objects can then be used as input for other cmdlets, or they can be stored in local variables for later use.

When you use the Microsoft Dynamics AX Management Shell or the Windows PowerShell console, you can load additional snap-ins. For more information, see Customizing Profiles.

Access the Microsoft Dynamics AX 2012 Management Shell

  1. On the Start menu, click All Programs.

  2. Click Administrative Tools.

  3. Click Microsoft Dynamics AX 2012 Management Console.

Permissions

Before you can use the Microsoft Dynamics AX 2012 Management Shell and the Windows PowerShell cmdlets, verify that you meet the following minimum requirements:

  • You have administrative permissions on the local computer.

  • You have System Administrator rights in Microsoft Dynamics AX.

  • If you are using model and modelstore management cmdlets, you must have the following additional rights in SQL Server:

    • You are a member of the Securityadmin server role on the SQL Server instance.

    • You are assigned to the db_owner role in a database.

  • If you are managing Enterprise Portal for Microsoft Dynamics AX, you must run the Windows PowerShell cmdlets on the server that runs Enterprise Portal. You must have the following rights:

    • Microsoft SharePoint Server farm administrator

    • Membership in the local Administrators group on the server that runs Enterprise Portal

  • If you are managing Microsoft SQL Server Reporting Services, you must have the following rights:

    • System Administrator rights in Reporting Services

    • Membership in the local Administrators group on the server that runs Reporting Services

Scripts and execution policies

Although you can use Windows PowerShell to perform a single administrative task, the real benefit of Windows PowerShell cmdlets is the capability to automate a series of tasks by using a script. A script is a plain text file that contains one or more Windows PowerShell cmdlets. Windows PowerShell scripts have a .ps1 file name extension.

To use a script, the minimum execution policy that is required for Microsoft Dynamics AX is RemoteSigned, whereas the default policy for Windows PowerShell is Restricted. If the policy is left as Restricted, the Microsoft Dynamics AX Management Shell changes the policy for Windows PowerShell to RemoteSigned. Therefore, the Microsoft Dynamics AX Management Shell must use elevated administrative permission. To start the Management Shell so that it uses elevated administrative permission, select Run as administrator. This change applies to all sessions of Windows PowerShell. For more information about scripts, see about_scripts. For more information about execution policies, see about_Execution_Policies.

Learning Windows PowerShell

The following information describes some of the learning resources that are available to help Microsoft Dynamics AX professionals who are not familiar with Windows PowerShell.

The TechNet Gallery includes many resources that can help you learn the basics of Windows PowerShell. The TechNet Gallery also contains script repositories that include samples of scripts that are frequently used together with various Microsoft products. The following table shows the main learning resources.

Page

Description

Windows PowerShell Documentation on TechNet

The section of the TechNet Library that contains web copies of the core Get Help topics for Windows PowerShell. This section also contains web copies of the Windows PowerShell Getting Started document, the PowerShell.exe Help, and a primer for Windows PowerShell.

Scripting With Windows PowerShell

The home page for learning resources for Windows PowerShell scripting.

Windows PowerShell Owner's Manual

A web-based guide that can help you start to work with Windows PowerShell.

Windows PowerShell Quick Reference

A downloadable copy of the Quick Reference document that is installed together with Windows PowerShell.

Windows PowerShell documents

Windows PowerShell installs the following documents in the Windows PowerShell 1.0 program group. These documents can also be installed after you download the Windows PowerShell 1.0 Documentation Pack.

File

Description

GettingStarted.rtf

Information about how to start to use Windows PowerShell.

UsersGuide.rtf

A primer for the Windows PowerShell environment and language.

QuadFold.rtf

A printable quick reference document for frequently used syntax and commands for Windows PowerShell. This document is also available as a download from the TechNet Scripting Center.

When you use these resources, you may find it useful to learn the following concepts and cmdlets before you use Windows PowerShell for Microsoft Dynamics AX:

See also

Windows PowerShell for Microsoft Dynamics AX

AxUtil and Windows PowerShell Commands for Deploying Models