Can't Install A Module That Can Be Imported

I am trying to speed up our profile script’s load times by installing all the modules that we use in our scripts for all users so that they are not needed every time we load up powershell. However, when I try to install the module, it says that it does not exist. When I try to find the module using Find-Module “dns”, it just comes back with xDnsServer. The modules I am trying to install are ActiveDirectory, PSDiagnostics, TroubleshootingPack, WDS, dnsclient, dnsserver, and dhcpserver. All of these modules produce the same result as shown below. Am I misunderstanding how modules work in powershell? Or am I messing up my usage of repositories? Any help or pointers would be appreciated.

Thanks!

 

[pre]

PS C:\windows\system32> Import-Module dnsclient -Verbose
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\dnsclient.psd1’.
VERBOSE: Loading ‘TypesToProcess’ from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\DnsCmdlets.Types.ps1xml’.
VERBOSE: Loading ‘TypesToProcess’ from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\DnsConfig.Types.ps1xml’.
VERBOSE: Loading ‘TypesToProcess’ from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\DnsClientPSProvider.Types.ps1xml’.
VERBOSE: Loading ‘FormatsToProcess’ from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\DnsCmdlets.Format.ps1xml’.
VERBOSE: Loading ‘FormatsToProcess’ from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\DnsConfig.Format.ps1xml’.
VERBOSE: Loading ‘FormatsToProcess’ from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\DnsClientPSProvider.Format.ps1xml’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\dnslookup.dll’.
VERBOSE: Importing cmdlet ‘Resolve-DnsName’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\MSFT_DnsClient.cdxml’.
VERBOSE: Importing function ‘Get-DnsClient’.
VERBOSE: Importing function ‘Register-DnsClient’.
VERBOSE: Importing function ‘Set-DnsClient’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\MSFT_DnsClientCache.cdxml’.
VERBOSE: Importing function ‘Clear-DnsClientCache’.
VERBOSE: Importing function ‘Get-DnsClientCache’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\MSFT_DnsClientGlobalSetting.cdxml’.
VERBOSE: Importing function ‘Get-DnsClientGlobalSetting’.
VERBOSE: Importing function ‘Set-DnsClientGlobalSetting’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\MSFT_DnsClientServerAddress.cdxml’.
VERBOSE: Importing function ‘Get-DnsClientServerAddress’.
VERBOSE: Importing function ‘Set-DnsClientServerAddress’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\PS_DnsClientNrptPolicy_v1.0.0.cdxml’.
VERBOSE: Importing function ‘Get-DnsClientNrptPolicy’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\PS_DnsClientNRPTGlobal_v1.0.0.cdxml’.
VERBOSE: Importing function ‘Get-DnsClientNrptGlobal’.
VERBOSE: Importing function ‘Set-DnsClientNrptGlobal’.
VERBOSE: Loading module from path ‘C:\windows\system32\WindowsPowerShell\v1.0\Modules\dnsclient\PS_DnsClientNRPTRule_v1.0.0.cdxml’.
VERBOSE: Importing function ‘Add-DnsClientNrptRule’.
VERBOSE: Importing function ‘Get-DnsClientNrptRule’.
VERBOSE: Importing function ‘Remove-DnsClientNrptRule’.
VERBOSE: Importing function ‘Set-DnsClientNrptRule’.
VERBOSE: Exporting function ‘Get-DnsClient’.
VERBOSE: Exporting function ‘Register-DnsClient’.
VERBOSE: Exporting function ‘Set-DnsClient’.
VERBOSE: Exporting function ‘Clear-DnsClientCache’.
VERBOSE: Exporting function ‘Get-DnsClientCache’.
VERBOSE: Exporting function ‘Get-DnsClientGlobalSetting’.
VERBOSE: Exporting function ‘Set-DnsClientGlobalSetting’.
VERBOSE: Exporting function ‘Get-DnsClientServerAddress’.
VERBOSE: Exporting function ‘Set-DnsClientServerAddress’.
VERBOSE: Exporting function ‘Get-DnsClientNrptPolicy’.
VERBOSE: Exporting function ‘Get-DnsClientNrptGlobal’.
VERBOSE: Exporting function ‘Set-DnsClientNrptGlobal’.
VERBOSE: Exporting function ‘Add-DnsClientNrptRule’.
VERBOSE: Exporting function ‘Get-DnsClientNrptRule’.
VERBOSE: Exporting function ‘Remove-DnsClientNrptRule’.
VERBOSE: Exporting function ‘Set-DnsClientNrptRule’.
VERBOSE: Exporting cmdlet ‘Resolve-DnsName’.
VERBOSE: Importing cmdlet ‘Resolve-DnsName’.
VERBOSE: Importing function ‘Add-DnsClientNrptRule’.
VERBOSE: Importing function ‘Clear-DnsClientCache’.
VERBOSE: Importing function ‘Get-DnsClient’.
VERBOSE: Importing function ‘Get-DnsClientCache’.
VERBOSE: Importing function ‘Get-DnsClientGlobalSetting’.
VERBOSE: Importing function ‘Get-DnsClientNrptGlobal’.
VERBOSE: Importing function ‘Get-DnsClientNrptPolicy’.
VERBOSE: Importing function ‘Get-DnsClientNrptRule’.
VERBOSE: Importing function ‘Get-DnsClientServerAddress’.
VERBOSE: Importing function ‘Register-DnsClient’.
VERBOSE: Importing function ‘Remove-DnsClientNrptRule’.
VERBOSE: Importing function ‘Set-DnsClient’.
VERBOSE: Importing function ‘Set-DnsClientGlobalSetting’.
VERBOSE: Importing function ‘Set-DnsClientNrptGlobal’.
VERBOSE: Importing function ‘Set-DnsClientNrptRule’.
VERBOSE: Importing function ‘Set-DnsClientServerAddress’.

PS C:\windows\system32> Install-Module -Name dnsclient -AllowClobber -AcceptLicense -Scope AllUsers -Verbose
VERBOSE: Using the provider ‘PowerShellGet’ for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider ‘NuGet’.
VERBOSE: The specified Location is ‘https://www.powershellgallery.com/api/v2/’ and PackageManagementProvider is ‘NuGet’.
VERBOSE: Searching repository ‘https://www.powershellgallery.com/api/v2/FindPackagesById()?id=‘dnsclient’’ for ‘’.
VERBOSE: Total package yield:‘0’ for the specified package ‘dnsclient’.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name ‘dnsclient’. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.3\PSModule.psm1:9550 char:21

  • … $null = PackageManagement\Install-Package @PSBoundParameters
  • CategoryInfo : ObjectNotFound: (Microsoft.Power…InstallPackage:InstallPackage) [Install-Package], Exception
  • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

[/pre]

Why are you trying to install a module, that is already installed?
If you can import it, then it’ already on the system.
Why are you doing this…
-AcceptLicense
… there is no license for modules in the PowerShellGallery.
There is also, no -AcceptLicense switch associated with the Import-Module.

# get function / cmdlet details
(Get-Command -Name Install-Module).Parameters

Key                 Value
---                 -----
Name                System.Management.Automation.ParameterMetadata
InputObject         System.Management.Automation.ParameterMetadata
MinimumVersion      System.Management.Automation.ParameterMetadata
MaximumVersion      System.Management.Automation.ParameterMetadata
RequiredVersion     System.Management.Automation.ParameterMetadata
Repository          System.Management.Automation.ParameterMetadata
Credential          System.Management.Automation.ParameterMetadata
Scope               System.Management.Automation.ParameterMetadata
Proxy               System.Management.Automation.ParameterMetadata
ProxyCredential     System.Management.Automation.ParameterMetadata
AllowClobber        System.Management.Automation.ParameterMetadata
SkipPublisherCheck  System.Management.Automation.ParameterMetadata
Force               System.Management.Automation.ParameterMetadata
Verbose             System.Management.Automation.ParameterMetadata
Debug               System.Management.Automation.ParameterMetadata
ErrorAction         System.Management.Automation.ParameterMetadata
WarningAction       System.Management.Automation.ParameterMetadata
InformationAction   System.Management.Automation.ParameterMetadata
ErrorVariable       System.Management.Automation.ParameterMetadata
WarningVariable     System.Management.Automation.ParameterMetadata
InformationVariable System.Management.Automation.ParameterMetadata
OutVariable         System.Management.Automation.ParameterMetadata
OutBuffer           System.Management.Automation.ParameterMetadata
PipelineVariable    System.Management.Automation.ParameterMetadata
WhatIf              System.Management.Automation.ParameterMetadata
Confirm             System.Management.Automation.ParameterMetadata

Get-help -Name Install-Module -Examples
Get-help -Name Install-Module -Full
Get-help -Name Install-Module -Online

If you are enabling / installing RSAT on Windows clients, then that is done for legacy clients by downloading the RSAT tools for the target OS, …

https://www.microsoft.com/en-us/download/details.aspx?id=39296

…and on the latest Win10 clients, RSAT is already there.

To install RSAT in Windows 10 1809, go to Settings -> Apps -> Manage Optional Features -> Add a feature. Here you can select and install specific tools from the RSAT package.

To install a specific RSAT tool, such as AD management tools (including the ADUC console), run the command:

Add-WindowsCapability –online –Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0"