Dbatools install

PS C:\Users\Administrator>

Install-Module -Name SqlServer
Install-Module -Name SqlServer -RequiredVersion 21.1.18256

WARNING: Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name ‘SqlServer’. T
ry Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
… $null = PackageManagement\Install-Package @PSBoundParameters
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Get-PSRepository

Name InstallationPolicy SourceLocation
PSGallery Untrusted https://www.powershellgallery.com/api/v2

Find-Module -Name "SqlServer"

Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4264 char:9
Get-PSGalleryApiAvailability -Repository $Name
+ CategoryInfo : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
+ FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability

forcing tls 1.2. solves most powershell gallery issues
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
! => did not work for set trusted , but it DID wotk for install module

nu echter : reeds geïnstalleerd fout
omdat reeds dbatools geïnstalleerd werd ?