PowerShell / PowerShellGallery

221 stars 61 forks source link

Failed to install module due to failed access to cloud file #145

Closed Tafnu07 closed 3 years ago

Tafnu07 commented 3 years ago

When trying to install VSSetup module by running the following command:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser Install-Module VSSetup -Scope CurrentUser -Force -Confirm:$false

But it fails with "Access to the cloud file is denied"

PackageManagement\Install-Package : Access to the cloud file is denied At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21

... $null = PackageManagement\Install-Package @PSBoundParameters


CategoryInfo : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Not sure how to resolve this issue.
ofmmmmm5 commented 3 years ago

Had the same issue when I tried to install az powershell with the command Install-Module -Name Az -AllowClobber -Scope CurrentUser -SkipPublisherCheck -Force . The error message is

PS C:\WINDOWS\system32> Install-Module -Name Az -AllowClobber -Scope CurrentUser -SkipPublisherCheck -Force                                                                                                                                                                    PackageManagement\Install-Package : Access to the cloud file is denied                                                                                                                                                                                                         At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34                                                                                                                                                                                   + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters                                                                                                                                                                                                    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

@Tafnu07 Did you get a chance solved this issue?

SydneyhSmith commented 3 years ago

Thanks @Tafnu07 this looks like the same issue as https://github.com/PowerShell/PowerShellGet/issues/300

I will close this as a duplicate

wirdatrd commented 3 years ago

Before anyone has a conniption, yes, I know it's bad practice, but:

Get rid of the "-Scope CurrentUser" parameter, and it should work fine. This seems to allow it to skip any path in the $env:PSModulePath that may be located on either a personal or work OneDrive location.

smflorentino commented 2 years ago

This worked for me after installing the latest PowerShellGet Beta (here). Note that the cmdlet names changed, now use Uninstall-PSResource