• About

Day 2 Day Dynamics

~ Experiences of a working AX developer

Day 2 Day Dynamics

Monthly Archives: February 2015

Setting up your PowerShell environment

27 Friday Feb 2015

Posted by John Hagler in Powershell

≈ 2 Comments

Tags

Automation, AX2012, Dynamics AX, PowerShell, Setup

Since the majority of my upcoming posts will revolve around PowerShell, I’ve decided to post about setting up your environment.  All of the things I will discuss can be found elsewhere and I will link to some of the sources that I’ve used but I’m hoping to give enough information that anyone can repeat my steps using only this blog. Also, in case anyone has issues or is just interested to know, I am using PowerShell version 3.0.

The first thing that you will need to do is set the execution policy of your environment.  The default execution policy is Restricted, meaning you will be unable to run any PowerShell scripts.  The most restrictive setting that you can have that will still enable you to run my scripts is RemoteSigned.  You can find more information here.

  • Set-ExecutionPolicy RemoteSigned

PS_Set-ExecutionPolicy

The next step is to get a profile set up.  PowerShell is largely session dependent and most things that you want to use need to be loaded into your session before they are available.  Setting up a profile gives you the ability to load things into a session by default.  The PowerShell commands that I use to set up my profile are below and you can find more information here.

  • Test-Path $profile
  • New-Item -path $profile -type file -force
  • notepad $profile

PS_CreateProfile

Most, if not all of the things that I am going to be talking about in the future start with the AX 2012 Management Utilities.  This is something that can be installed using your AX 2012 installation media and is required to be installed on the server where you will be running these scripts.

Installing the AX 2012 Management Utilities gives you access to the Microsoft Dynamics AX 2012 Management Shell.  You can find more information here.  This is another PowerShell client with some things preloaded and some UI changes.  I prefer to use the standard PowerShell client so I preload the same things using my profile.

The script that is used by the AX 2012 Management Shell is saved by default to “C:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1”.  Adding this to your profile, prefixed with a period, will call this script and load the necessary modules into your PowerShell client session the next time it is started.  An example of my profile can be found here.  This example will also be updated with future posts so make sure you only grab what is necessary for you when downloading it.

PS_ManagementUtilities

This is as far as I plan to go today. I just wanted to walk you through the steps that are prerequisites for using the PowerShell functions that I will be talking about in later posts. Also, if you plan on using the PowerShell IDE client for examining these functions, be aware that the IDE client uses a separate profile so you will need to duplicate the profile steps for the IDE client as well.

Introduction

20 Friday Feb 2015

Posted by John Hagler in Uncategorized

≈ Leave a comment

Over the last year and a half, I have spent many hours learning Powershell and researching automated builds for Dynamics AX 2012.  I have found some amazing resources online that have gotten me to a working process:

  • Dynamics Ax Musings
  • Dynamics AX Admin Utilities
  • DynamicsAXCommunity Powershell Module
  • AX 2012 BuildScripts

There are many more resources out there now, these are just the main ones I used to arrive at my build process.  In fact, the DynamicsAXCommunity Powershell module is required for some of my build functions.

Over the next few months I will be documenting my custom Powershell functions and eventually creating a module for them.  I will also attempt to integrate the latest version of the DynamicsAXCommunity module with them as the version I’m using has been customized.  I’m hoping that this documentation may help other developers out there who are trying to create an automated build for AX 2012.

All of the code that will be discussed in this blog can be found in Codeplex.

Follow Day 2 Day Dynamics on WordPress.com

Day 2 Day Dynamics

  • RSS - Posts
  • RSS - Comments

Follow me on Twitter

My Tweets

Recent Posts

  • Minimizing Database Calls
  • Push-AXModel custom PowerShell function
  • Clean-AXModel custom PowerShell function
  • Get-AXTFSCombinedXpo custom PowerShell Function
  • Refresh-AXAifPort custom PowerShell function

Archives

  • February 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015

John Hagler

John Hagler

John Hagler

I am the Dynamics AX Technical Architect at Dealer.com. I have been working with AX since Sep. 2006, starting with Axapta 3.0. I have worked as both a VAR and an AX customer.

View Full Profile →

Blog at WordPress.com.

  • Follow Following
    • Day 2 Day Dynamics
    • Already have a WordPress.com account? Log in now.
    • Day 2 Day Dynamics
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...