Suppress prompt confirmation for Import-Module PowerShell?

133 views Asked by At

I am trying to import akamaipowershell powershell module using script while importing it prompts for install nuget package but I want to skip that prompt same as NO.

Import-Module ./akamaipowershell -Force

I have tried using the Force parameter but still getting prompt and when I am trying to use -Confirm:$False getting invalid parameter.

1

There are 1 answers

0
CFou On BEST ANSWER

The guilty for this is the checking for a module update when import it (line 28 Find-Module AkamaiPowerShell of the .psm1 file).

As you can see it on the previous line, you can set an environment variable to block this behaviour before importing the module :

$env:AkamaiPowerShellDisableUpdateCheck = $true
Import-Module ./akamaipowershell

This will not ask for installing the nuget package.