Jun 11 2018 05:50 AM - edited Jun 12 2018 06:47 AM
I am running PSVersion 5.1.16299.431 and have set my proxy using NetSH WinHTTP Set Proxy proxy-server="my.proxy.server"
I would like to "Install the preview version of the Azure Active Directory Module for Windows PowerShell" as per https://support.office.com/en-gb/article/Manage-who-can-create-Office-365-Groups-4c46c8cb-17d0-44b5-... However, on running Install-Module AzureAD I see "PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'AzureAD'. Try Get-PSRepository to see all available registered module repositories."
I can run Register-PSRepository -Default without issue but when I run Get-PSRepository I am faced with "WARNING: Unable to find module repositories."
I have been able to run update-help, so I assume I can get online ok.
Finally, I tried to Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/
-Proxy my.proxy.server but see the message, "Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable. Please try again later."
Can someone please advise what I need to do to be able to successfully Install-Module AzureAD?
Jun 11 2018 06:33 AM
Please try to install the latest PowershellGet module as described here https://www.powershellgallery.com/packages/PowerShellGet/1.6.5 and try you actions again.
You can try both Azure Ad versions
Install-Module AzureAD or Install-Module AzureADPreview
Jun 11 2018 10:56 AM
Have you tried the -Proxy/-ProxyCredential parameters? 🙂
Jun 12 2018 01:29 AM
@Maluks, thank you for the suggestion. When I run Get-Module -Name PowerShellGet -ListAvailable | Select-Object -Property Name,Version,Path it results in the following output:
Name Version Path
---- ------- ----
PowerShellGet 1.0.0.1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1
However, when I then run Install-Module PowerShellGet -Force I get the output:
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'PowerShellGet'. Try Get-PSRepository to see all available registered module repositories.
Also, when I run Save-Module -Name PowerShellGet -Path "c:\mydir" I get output:
PackageManagement\Save-Package : No match was found for the specified search criteria and module name 'PowerShellGet'. Try Get-PSRepository to see all available registered module repositories.
Any other way to Install-Module AzureAD you can suggest?
Jun 12 2018 01:33 AM
@VasilMichev, yes I did also try Install-Module AzureAD -proxy "my.proxy.server" with output:
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'AzureAD'. Try Get-PSRepository to see all available registered module repositories.
Jun 20 2018 05:37 AM
Have you tried:
Get-Module -Name PowerShellGet -ListAvailable | Install-Module
Jun 22 2018 02:33 AM - edited Jun 22 2018 02:34 AM
Thank you for the tip @Thomas Lee, when I run Get-Module -Name PowerShellGet -ListAvailable | Install-Module I get output:
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'PowerShellGet'. Try Get-PSRepository to see all available registered module repositories.
Is this expected given that the get-module -ListAvailable match for PowerShellGet did list a path in C:\Program Files\WindowsPowerShell? Also, it part of the issue that get-module and get-psrepository don't have parameters to set a proxy? As I mentioned before, I did have set my proxy using NetSH WinHTTP Set Proxy proxy-server="my.proxy.server".
I'm running out of options running with this network configuration, as the proxy seems to be the issue. I have managed to install the module on another device outside the network.
Jun 22 2018 03:11 AM
Whoops - my bad - a typo in my suggestion.
Instead of Get-Module -list, it should have been Find-Module PowerShellGet | Install-module
Jun 26 2018 08:48 AM
Jul 03 2018 06:33 AM
Thank you all for your help. Solution found!
https://blogs.technet.microsoft.com/keithmayer/2016/01/06/quick-tip-using-azure-powershell-with-web-... at Step 2 (Optional) – Add Proxy Credentials to Script:
To use Windows credentials for proxy authentication, you can add …
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
...and when I added that in a new PowerShell session, Get-PSRepository shows the expected:
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2/
...and Install-Module AzureADPreview works, so obviously a proxy issue all along.
Jan 23 2019 03:12 AM
May 05 2019 01:36 PM - edited May 05 2019 01:38 PM
@Reinier SPRUIJTIn my case, I removed "Automatically detect setting Local Area Network (LAN) Settings" and Protected Mode from IE to install and use the module. I was on a server.
May 11 2020 04:21 PM
Hello Reinier,@Reinier SPRUIJT
I have the same problem, please could you share with me the solution.
thank youu.
cordially
May 28 2020 05:34 PM
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Using TLS1.2 connection resolved the problem for me. Try executing the above command before installation.
Jun 16 2020 05:31 AM - edited Jun 16 2020 05:32 AM
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
This fixed it for me as well
Jun 18 2020 11:22 AM
SolutionI followed this article, and the "Microsoft way" didn't work. I needed to execute the second block of commands:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 Register-PSRepository -Default -Verbose Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Jul 13 2020 01:32 AM
@Reinier SPRUIJT Thank you for the solution. It helped me as well.
Sep 14 2020 02:21 PM
Setting TLS1.2 connection resolved the problem for me. Thank you so much.
Sep 15 2020 01:23 PM
Jun 16 2021 03:24 AM
Jun 18 2020 11:22 AM
SolutionI followed this article, and the "Microsoft way" didn't work. I needed to execute the second block of commands:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 Register-PSRepository -Default -Verbose Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted