PowerShell global tool
| Product | Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
I am creating an installer using Inno Setup on Windows 10/11 and I am facing issues with installing NuGet and a PowerShell module (AudioDeviceCmdlets) system-wide.
Additional Information
- The installer runs with Admin rights, so installing the modules is not a problem.
- I need to be able to run the installed PowerShell modules from within the installer.
- I need to be able to run the installed PowerShell modules from within the application that is being installed (let’s call it
myApp). myAppwill run with either Admin rights or non-admin rights
What I’ve Tried
Inside the Installer
PowerShell Script: I tried running a PowerShell script using
Execwithin the Inno Setup installer to install the NuGet package provider and theAudioDeviceCmdletsmodule:Install-PackageProvider -Name NuGet -Force; Install-Module -Name AudioDeviceCmdlets -Force -SkipPublisherCheck; ...rest of the code...CMD Script: Then, I moved these commands to a
.cmdfile:PowerShell.exe -ExecutionPolicy Bypass -Command "Install-PackageProvider -Name NuGet -Force" PowerShell.exe -ExecutionPolicy Bypass -Command "Install-Module -Name AudioDeviceCmdlets -Force -SkipPublisherCheck" ...rest of the code...
Question
- How can I get the PowerShell modules to be available system-wide after the installation?
I’ve been going back and forth on this for a while and can’t figure out how to get it to work properly. Any help would be appreciated.
asked Sep 26, 2023 at 14:32
After more troubleshooting I realised that the environment variables dump I’d get from the installer vs from a manually-opened PowerShell Window were a bit different. I started from the first difference that was logged, namely the installer I created in InnoSetup was running in a 32-bit environment, while the PowerShell Window was running in a 64-bit environment.
Changing the installer so that it forced the 64-bit environment, i.e.
[Setup]
; existing setup directives...
ArchitecturesInstallIn64BitMode=x64 ; Run installer as 64-bit on x64 architecturessolved my problem. Now, the PowerShell commands run in the installer download/install/import the PowerShell modules I need and those are available for usage when I run myApp.
answered Sep 27, 2023 at 12:38
I am facing issues installing the NuGet package provider for PowerShell on an offline machine.
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
At line:1 char:1
+ Install-PackageProvider -Name NuGet -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProviderAt the same time, running Import-PackageProvider -Name NuGet works perfectly well. But I’d have to run that command every time PowerShell starts, be it either manually or by including it in the profile. After running Import-PackageProvider -Name NuGet and restarting PowerShell, the package provider is not automatically loaded. That is pretty undesirable.
Adding the -Force flag to the Install-PackageProvider invocation makes no difference.
I have looked at the documentation for Install-PackageProvider but can’t seem to find any parameter I ought to be passing for offline installations like mine. Microsoft’s documentation on offline NuGet package provider installs only mentions importing the package provider and no further steps.
So I am somewhat at a loss as to what to do now. Any help would be much appreciated!
PowerShell global tool
| Product | Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
- From a server connected to the internet and with access to the Microsoft Gallery, open the command prompt to install the NuGet provider.
- Run the Install-PackageProvider NuGet -MinimumVersion 2.8.5.206 -Force command.
- After installation, you can find the provider under C:\Program Files\PackageManagement\ProviderAssemblies.
- Copy the NuGet folder to an external media or find a way to get it onto your target system with no internet access.
- Copy the NuGet folder on your target computer under C:\Program Files\PackageManagement\ProviderAssemblies.
- Start a new PowerShell session on the target computer to auto-load the package provider.
- Create a new folder for the nupkg packages’ local source location. For example, C:\Packages.
- Copy your nupkg files into C:\Packages.
- In PowerShell, run the Register-PSRepository -Name Local -SourceLocation C:\Packages -InstallationPolicy Trusted command to register your new local source location.
- You can run the Find-Module -Repository Local command to list the available packages.
- Run the Install-Module -Name <YourModuleName> -Repository Local -scope allusers -verbose command, where <YourModuleName> is the name of your package returned by the command in step 8.
For example, Install-Module -Name SqlServer -Repository Local -scope allusers -verbose. - The installation is done. ✅
Did you find this helpful?
Sorry about that
Why wasn’t this helpful? (check all that apply)
Thanks for your feedback.
Want to tell us more?
Send an email to our authors to leave your feedback.
Email our authors
Sorry, but we can’t provide technical support from this email address. If you need assistance, then please contact our support team directly.
Great!
Thanks for taking the time to give us some feedback.
PowerShell global tool
| Product | Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.


