PowerShell Exchange online - Download - powershell

Where can I download Exchangeonline?
I am unable to use PowershellGet or NuGet as the proxy won't allow download via PS.
I get the below error.
PS C:\Windows\system32> find-module exchangeonline
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires
'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
At C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 char:21
+ ... $null = PackageManagement\Install-PackageProvider -Name $script:N ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception
+ FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name 'NuGet'. Try 'Get-PackageProvider -ListAvailable' to
see if the provider exists on the system.
At C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7474 char:21
+ ... $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (NuGet:String) [Import-PackageProvider], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider

The correct name is ExchangeOnlineManagement
Find-Module ExchangeOnlineManagement
You can try running it like this to ensure any proxy authentication is passed to the command:
[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Find-Module ExchangeOnlineManagement
Failing this, you can manually download the package from PSGallery - https://www.powershellgallery.com/packages/ExchangeOnlineManagement/3.0.0 and install it manually - https://learn.microsoft.com/en-us/powershell/scripting/gallery/how-to/working-with-packages/manual-download?view=powershell-7.3

Related

Error during installing PSWindows Update module

I was going to automate some regular task on client computers using Powershell module. In this way, PSWINDOWSUPDATE is one of bests. But, I receive an error during install that:
PS C:\Users\stackoverflow> install-module -name pswindowsupdate -scope currentuser
PackageManagement\Install-Package : Package 'PSWindowsUpdate' failed to be installed because:
Access to the path 'C:\Users\stackoverflow\AppData\Local\Temp\ipufiq2h\PSWindowsUpdate.dll' is denied.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ... $null = PackageManagement\Install-Package #PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (PSWindowsUpdate:String) [Install-Package], Exception
+ FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement
.Cmdlets.InstallPackage
running the command in administrative mode and without -scope switch didn't solve the problem.
Edit1: The problem is solved. But there is another problem. When I call import-module pswindowsupdate following error occurs:
import-module : Errors occurred while loading the format data file:
C:\Users\stackoverflow\Documents\WindowsPowerShell\Modules\pswindowsupdate\2.2.0.2\PSWindowsUpdate.Format.ps1xml, ,
C:\Users\stackoverflow\Documents\WindowsPowerShell\Modules\pswindowsupdate\2.2.0.2\PSWindowsUpdate.Format.ps1xml: The file was skipped because of the following validation exception: File
C:\Users\stackoverflow\Documents\WindowsPowerShell\Modules\pswindowsupdate\2.2.0.2\PSWindowsUpdate.Format.ps1xml cannot be loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170..
At line:1 char:1
+ import-module pswindowsupdate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Use Get-ExecutionPolicy to set it e.g. to RemoteSigned:
Get-ExecutionPolicy -List
Set-ExecutionPolicy RemoteSigned
also see here

Can't install Exchange Online PowerShell V2 module

I'm trying to enable modern authentication for an O365 tenant, and then instructions say to import the Exchange Online Management module. I don't have that module, so those same instructions say to install it by using
Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5
But then I get this error
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
'ExchangeOnlineManagement'. Try 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], E
ception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Just in case I did also run this to check
Get-PSRepository
And the result was
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
And that seems correct. So does anybody know why it's not working.
Thanks!
Just replying with the answer in case it helps anyone else who stumbles across this in future. It was a TLS issue, and the fix was simply:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
After that everything worked as it should.

Issues with Registering PSRepository and Installing VMWare PowerCLI Module

My Setup: Windows 10.17134, PowerShell 5.1.17134.407
When trying to Register a new PSRepository using the Code below….
Register-PSRepository -Name "PSGallery" –SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted
….it gives me the following error:
FullyQualifiedErrorId : UseDefaultParameterSetOnRegisterPSRepository,Register-PSRepository
I am not able to install the VMWare PowerCLI Module with this command:
Save-module -Name vmware.powercli -path c:\temp
….it gives me this error:
FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage
Here are the results of a days googling
I'm running
Register-PSRepository
-Name "PSGallery"
–SourceLocation "https://www.powershellgallery.com/api/v2/"
-InstallationPolicy Trusted
(multiline for clarity)
and I kept getting
Register-PSRepository : Use 'Register-PSRepository -Default' to
register the PSGallery repository. At line:1 char:1
+ Register-PSRepository -Name "PSGallery" –SourceLocation "https://www. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (PSGallery:String) [Register-PSRepository], ArgumentException
+ FullyQualifiedErrorId : UseDefaultParameterSetOnRegisterPSRepository,Register-PSRepository
I assumed this was to do with proxy settings so I tried all of the various methods of setting the proxy in powershell to no avail.
Finally I ran
Get-PSRepository
and discovered that the repository was already registered, it was just untrusted
So I ran
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
The original reason I had for doIng this is because when I run
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
I get
Install-PackageProvider : No match was found for the specified search
criteria for the provider 'NuGet'. The package provider requires
'PackageManagement' and 'Provider' tags. Please check if the specified
package has the tags. At line:1 char:1
+ Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.PowerShel\u2026tallPackageProvider:InstallPackageProvider)
[Install-PackageProvider], Exception
+ FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
Unfortunately, making the repository trusted did no help with my issue
... and the original reason for doing this was so I could run
Install-Module -Name SqlServer -Force -Verbose -Scope CurrentUser
Which was failing (sorry no error message, it was so long ago)
After all my fiddling however, this statement now works without error.
Not sure if it was all the proxy config, or making NuGet trusted or both
I've been chasing this problem for days. I isolated it to Install-PackageProvider not being able to download:
Microsoft.PackageManagement.NuGetProvider-2.8.5.208.dll
In my case, my company does not allow us to download DLLs from the internet without due process. I engaged due process and got an approved copy of the DLL. Then it needs to be placed here:
$env:ProgramFiles\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll
Note the version becomes a folder and is stripped from the name.
Manually doing so eliminates the need to run Install-PackageProvider. Some articles state that Import-PackageProvider is necessary to get PowerShell to recognise it. But, I did not need to do the Import. Just try Install-Module -Name SqlServer -Force again.

Face difficulties on registering the SitecoreGallery repository

Want to install Sitecore9.1, first of all, try to register the repository in PowerShell.After running the following command get an error. Why error raise? need help to resolve this issue.
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2
Error:
PackageManagement\Register-PackageSource : Module Repository 'SitecoreGallery' exists.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4173 char:17
+ ... $null = PackageManagement\Register-PackageSource #PSBoundParamete ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-Pack
ageSource], Exception
+ FullyQualifiedErrorId : PackageSourceExists,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource
The error says that this repository already exists. First, check if it's registered properly:
PS C:\> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2/
SitecoreGallery Untrusted https://sitecore.myget.org/F/sc-powershell/api/v2
If it is registered with incorrect data, you can change it:
Set-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2

'Set-AzureRmDataFactoryV2' is not recognized as the name of a cmdlet

I have installed Powershell 6.0.0 on Ubuntu 16.04. I am getting following error when trying to create Azure Data Factory using Powershell
Set-AzureRmDataFactoryV2 : The term 'Set-AzureRmDataFactoryV2' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:16
+ $DataFactory = Set-AzureRmDataFactoryV2 -ResourceGroupName $ResGrp.Re ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureRmDataFactoryV2:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Then I tried to install the module and getting the following error
Install-Module AzureRM -AllowClobber
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"): Y
PackageManagement\Install-Package : The member 'TypesToProcess' in the module manifest is not valid: Cannot find path '/tmp/787167149/Azure.Storage/.\Microsoft.WindowsAzure.Commands.Storage.Types.ps1xml' because it does not exist.. Verify that a valid value is specified for this field in the '/tmp/787167149/Azure.Storage/Azure.Storage.psd1' file. At /opt/microsoft/powershell/6.0.0/Modules/PowerShellGet/1.6.0/PSModule.psm1:2057 char:21 + ... $null = PackageManagement\Install-Package #PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (/tmp/787167149/...re.Storage.psd1:String) [Install-Package], Exception + FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Currently, Set-AzureRmDataFactoryV2 cmdlet is not supported on Linux. AzureRM.NetCore supports following services.
Virtual Machine
App Service (Websites)
SQL Database
Storage
Network
More information please refer to this official document.
If possible, I suggest you could use Azure CLI.
I have solved this issue in my machine by updating Az.DataFactory module.
Install/update latest AzureRM.DataFactoryV2 module.
Restart your powershell.
try the above command.
it will work successfully.