An Introduction to PowerShell – Profile

PowerShell is a great way to automate almost anything in Windows.

However, it’s not just a scripting language.

If you find yourself using it as a command line shell it may be useful to store your functions and customizations in a profile that gets loaded every time you load the Console.

The first thing we do here is check if we already have a profile. There is an automatic variable, $Profile, that stores the fully qualified location of the PowerShell profile. An easy way to check if any profile exists is to use the Test-Path cmdlet on the $Profile variable.

Test-Path $Profile

PS-18

As you can see no profile file yet created for me, so we will create one, we can easily do that with the New-Item cmdlet.

New-Item –Path $Profile –Type File –Force

Using the force parameter will cause a profile to be created even if already we have one. This means our old profile will be overwritten and new will be created.

PS-19

Profile can be edit using notepad, which can be easily started using PowerShell.

notepad $Profile

PS-20

You can put any commands, functions, alias’s and even module imports into your PowerShell profile.

I normally work on PowerShell for Navision so I would prefer loading module whenever I launch the PowerShell command, so I include my cmdlets for loading the same in my profile.

PS-21

Save the Profile and close the PowerShell. Next time I launch PowerShell this Module get loaded for me by default.

Finally, I would like to also have some customizations to the console. One is it basically determines if you have opened an elevated PowerShell console and changes the font colour, this way I will always remember that I am running with elevated privileges.

Let us Save the Profile and check the effect of this Profile.

PS-22

That’s all for today.

I will come up with more stuffs in my upcoming posts.

Till then keep practicing and stay tuned for more details.

 

Working with Profiles in Navision 2016

How to: Create a Profile

You use the Profile card to create profiles for end users. Each profile is associated with a  Role Center. Profiles are typically based on job titles in a company.

To create a profile

Profiles-1

  • In the Profile ID field, enter a name that describes the intended role of the user.
  • In the Owner ID field, click the AssistEdit button to view all available logins, and then select a Windows user.
  • In the Description field, enter a description of the Profile ID, for example, Order Processor.
  • In the Role Center ID field, click the AssistEdit button to view all available Role Centers. Select a Role Center.
  • To make this Role Center the default for the profile, select Default Role Center.
  • Click OK to save your changes.

The procedure for modifying an existing profile is the same, except you select an existing profile in the Profiles page instead of clicking New.

How to: Assign a User to a Profile

You use the User Personalization page to assign a user to a profile.

To assign a user to a profile

Profiles-2

  • In the User Personalization window, fill in the fields described in the following table.
Field Description
User ID Choose the AssistEdit button to view all available user logins, select the relevant user, and then choose the OK button.
Profile ID Select a profile ID that you have already created. Choose the AssistEdit button to view all available profiles.
Language ID Select the appropriate language ID, or leave this field blank.
Company Select a company from the Companies window.
  • Choose the OK button.

Note The Language ID and Company values are overwritten by user values when the user starts a session.

How to: Open Microsoft Dynamics NAV in Configuration Mode

To configure a profile, for example to customize the profile’s user interface, you must open the Microsoft Dynamics NAV Windows client in configuration mode.

To open the Microsoft Dynamics NAV Windows client in configuration mode

  • At the command prompt, navigate to the root folder of the Microsoft Dynamics NAV Windows client. For example:

cd C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client

  • Type the following command:

Microsoft.Dynamics.Nav.Client.exe -configure -profile:”profileid”

Replace profileid with the name of the profile that you want to configure.

Important You must be the owner of a profile to open it in configuration mode

For example, to configure the Accounting Manager profile, use this command to open the Microsoft Dynamics NAV Windows client in configuration mode:

Microsoft.Dynamics.Nav.Client.exe -configure -profile:”Accounting Manager”

Important

Most of the contents you find in this blog will be either inherited from MSDN or Navision Developer IT Pro Help. Some places images are also directly taken from these sites. Purpose is simple to try those stuffs and re-produce adding few things as per my understanding to make easy understanding for others and quick reference.

Here nothing under my own brand or authorship of the content. At any point of time we are just promoting Microsoft stuffs nothing personnel with same.

Hope stuffs used here will not violate any copyright agreement with them. In case by mistake or in-intestinally it happens and the Microsoft feels these should not be used Microsoft have full right to inform me about same and will be glad to take down any such content which may be violating the norms.

Purpose is to promote Navision and share with community.

FB Profile

Like FB Page

%d bloggers like this: