Mar 18, 2014 - 2 Comments - App-V, App-V 5.0 -

App-V 5.0 and Your PowerShell Profile

As we all know App-V 5.0 is all about PowerShell and if you’re anything like me you’re always running your import-module appvclient command on the machines you work with.

Well today I want to share with you a handy tip that will allow you to save that time by editing your PowerShell Profile, as covered in depth in the PowerShell Owner’s Manual on TechNet.

So first things first is understanding where our PowerShell profile actually is, you do this by running the following in PowerShell:

$profile

It should return something like this:

You can check to see you already have a profile created by using:

Test-Path $profile

If it returns false we need to create a profile, this can be done by running the following:

New-Item -path $profile -type file -force

The output should be similar to below:

Now we are able to use notepad to view and edit our profile by running:

notepad $profile

Now it’s up to you what you put into this profile, for App-V we can insert the following:

Import-Module “C:\Program Files\Microsoft Application Virtualization\Client\AppvClient\Microsoft.AppV.AppvClientComConsumer.dll”

Import-Module “C:\Program Files\Microsoft Application Virtualization\Client\AppvClient\Microsoft.AppV.AppVClientPowerShell.dll”

Import-Module “C:\Program Files\Microsoft Application Virtualization\Client\AppvClient\Microsoft.AppV.ClientProgrammability.Eventing.dll”

Hit save and you’re done! The next time you launch PowerShell your module will already be loaded and your first App-V command of the day will be extra quick!

2 Responses to App-V 5.0 and Your PowerShell Profile

  1. karthik

    Hi,

    I am working on a application where it calls a power shell script during add package phase. As you know, we need to unrestrict(set-executionpolicy unrestricted to y) an execution policy before doing any operations in powershell command. We created a powershell script and added that script inside appv-5.0 package in the scripts tab. Added required code inside the deploymentconfig.xml file. Every thing looks good.

    But we need to use -executionpolicy bypass -file “Powershell file path” inside the deploymentconfig.xml file. As we are enabling the execution policy while adding the package why we need to add -executionpolicy bypass -file “Powershell file path” inside the deploymentconfig.xml file? If we are writing only powershell file path without exection policy bypass inside the deploymentconfig.xml, we are seeing that powershell script is not able to run.

    Can you please help!!!

    17 Dec 2014 - Reply
    • Thamim Karim

      Hi Karthik, It sounds like your execution policy isn’t being set by the add script, can you test this and verify?

      17 Dec 2014 - Reply
Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>