PowerShell for the Power Platform-Modules-available

Install PowerShell for the Power Platform without admin rights

Have you tried installing PowerShell for the Power Platform yet? One of the annoying things is that you need to have admin rights.

Earlier this week I saw someone mention an option to avoid the Install-Module on LinkedIn. By doing so the need fro Admin rights was also avoided. I would have liked to include a link to that post but I can’t find it.

Install PowerShell for the Power Platform

Using the Save-Module option you can download a module the same way as install module does. without the need for local admin rights.

In the installation documentation the following lines of code are given:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber

Without Admin rights

Rather than using the above lines I’m using the following lines:

if ($env:PSModulePath -notlike "*c:\Projects\Modules*")
{
   if((Get-Item c:\projects\Modules -ErrorAction SilentlyContinue ) -eq $null) {
   New-Item -Path c:\projects -Name "Modules" -ItemType "directory"
}
$env:PSModulePath += ";c:\Projects\Modules"
}
Save-Module -Name Microsoft.PowerApps.Administration.PowerShell -Path c:\Projects\Modules
Import-Module -Name Microsoft.PowerApps.Administration.PowerShell
Save-Module -Name Microsoft.PowerApps.PowerShell -Path c:\Projects\Modules
Import-Module -Name Microsoft.PowerApps.PowerShell

Ok, that is a lot of lines to replace just 2 lines.

The first part of the code will setup the PSModulePath variable. This variable is used to make the modules in specified folders available. Once that is done the modules can be imported.

PowerShell for the Power Platform available

 

An alternative

As mentioned by Pen Warner, You could also consider the following two lines if you are not worried about the location of your modules:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell  -Scope CurrentUser
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber -Scope CurrentUser

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: