Install PowerShell Modules behind proxy

Hello,
I have to install powershell modules of Exchange Online, SharePoint Online, Azure ....

I can manually download these modules & install them, however the issue is that I need them on more than one server .
I have the servers behind the proxy.

When I run Install-module -name .... I get the following error:
The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags......

Can someone help me get over this error & let me know how to resolve this issue?
LVL 11
AcklesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AcklesAuthor Commented:
Anyone
Vasil Michev (MVP)Commented:
Did you configure the proxy settings? You should use the net command, here's how to get the current proxy config:

netsh winhttp show proxy

Open in new window

AcklesAuthor Commented:
Current WinHTTP proxy settings:

    Direct access (no proxy server).

However in IE the proxy is set
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Vasil Michev (MVP)Commented:
IE doesnt matter, you need to configure the winhttp proxy setting, as this is what PowerShell uses.
AcklesAuthor Commented:
In that case these are the settings, what should I do?
Vasil Michev (MVP)Commented:
You should configure them via the net command, as I already mentioned above. Here's an example:

netsh winhttp set proxy "192.168.0.1:8080"

For more examples, refer to the tool help.
AcklesAuthor Commented:
The winrm config is :

winrm get winrm/config/client
Client
    NetworkDelayms = 5000
    URLPrefix = wsman
    AllowUnencrypted = false [Source="GPO"]
    Auth
        Basic = false [Source="GPO"]
        Digest = false [Source="GPO"]
        Kerberos = true
        Negotiate = true
        Certificate = true
        CredSSP = false
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    TrustedHosts = *
AcklesAuthor Commented:
Ok, I set the proxy & now it shows Proxy Server in list
However, when I try
New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $cred -Authentication "Basic" -AllowRedirection

I get error:

New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following
error message : The WinRM client cannot process the request. Basic authentication is currently disabled in the client
configuration. Change the client configuration and try the request again. For more information, see the
about_Remote_Troubleshooting Help topic.
At line:1 char:13
+ $exchange = New-PSSession -ConfigurationName Microsoft.Exchange -Conn ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : -2144108321,PSSessionOpenFailed
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Look at your WinRM config aou oisted, it clearly states that you cannot use Basic, Digest or CredSSP for authentication. Use Negotiate, that should work.
AcklesAuthor Commented:
Error with Negotiate


New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following
error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was
not available. This is usually returned by a HTTP server that does not support the WS-Management protocol. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:13
+ $exchange = New-PSSession -ConfigurationName Microsoft.Exchange -Conn ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed
Vasil Michev (MVP)Commented:
Basic auth is a requirement when you're connecting to ExO, so you need to have this sorted with your admins (or override the GPO yourself, assuming you have local admin privileges).
AcklesAuthor Commented:
I can override, could you guide me in the direction....
AcklesAuthor Commented:
I've set the registry value to 1: HKLM\SOFTWARE\POLICIES\MICROSOFT\WINDOWS\WINRM\SERVICE\ALLOWBASIC

but in Powershell it still shows the same result
winrm get winrm/config/client
Client
    NetworkDelayms = 5000
    URLPrefix = wsman
    AllowUnencrypted = false [Source="GPO"]
    Auth
        Basic = false [Source="GPO"]
Vasil Michev (MVP)Commented:
Just delete the key. Or set it directly via PowerShell:

PS C:\> cd WSMan:
PS WSMan:\> cd .\localhost\Client\Auth
PS WSMan:\localhost\Client\Auth> set-Item basic $true

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AcklesAuthor Commented:
throws error : the config setting Basic can't be changed, set by policy....

Even if I'm localadmin, can't be changed
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Then you might have to stop the GPO from getting applied against your machine ...
AcklesAuthor Commented:
If I could, why would I do the whole practice .....
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
If you could, you would be able and allowed to do (make changes to GPOs).

But it is time now to make this a different question. The original issue of setting up using a proxy for installing PS modules is resolved, you now have issues with running the individual modules.
AcklesAuthor Commented:
I didn't realize this was Microsoft Support.....
Vasil Michev (MVP)Commented:
Well we cannot really help you bypass restrictions set by your domain admins. In general, if you are a local admin on the device, you can overwrite the policy settings, but this will only apply until the next time policies are processed. So best talk to your admins, or use a machine that doesnt have such restrictions.
AcklesAuthor Commented:
no worries, Thanks a lot!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.