I am setting up a new server that has no internet connection, I need to install sqlserver module for powershell. this document is helpful
https://docs.microsoft.com/en-us/powershell/module/packagemanagement/install-packageprovider?view=powershell-6
Step 1. Manually Download the package provider NuGet on a computer that has internet
https://docs.microsoft.com/en-us/powershell/module/packagemanagement/install-packageprovider?view=powershell-6
Step 1. Manually Download the package provider NuGet on a computer that has internet
- Run Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force to install the provider from a computer with an internet connection.
- After the install, you can find the provider installed in $env:ProgramFiles\PackageManagement\ReferenceAssemblies\\\<ProviderName\>\\\<ProviderVersion\> or $env:LOCALAPPDATA\PackageManagement\ProviderAssemblies\\\<ProviderName\>\\\<ProviderVersion\>.
- (In my case, The file name is Microsoft.PackageManagement.NuGetProvider.dll )
- Place the <ProviderName> folder, which in this case is the Nuget folder, in the corresponding location on your target computer.
- (In my case, it’s C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.201)
Step 2. Manually
download the sqlserver module from computer that has internet
After the download, copy this
file sqlserver.21.1.18209.nupkg to the target server. I put the file in a non-specific folder.
Step 3. Install sqlserver module
Restart PowerShell to auto-load the package provider. Alternatively, run
Get-PackageProvider -ListAvailable to list all the package providers available
on the computer. Then use Import-PackageProvider -Name NuGet -RequiredVersion
2.8.5.201 to import the provider to the current PowerShell session.
PS C:\Windows\system32> Install-Module -Name
SqlServer
Untrusted repository
You are installing the modules from an
untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the
Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes
[A] Yes to All [N] No [L] No to All
[S] Suspend [?] Help (default is "N"):
A
PS C:\Windows\system32>
Comments
Post a Comment