powershellpowershell-2.0import-module

Suppress prompt confirmation for Import-Module PowerShell?


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.


Solution

  • 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.