Tuesday, April 23, 2024
HomePowershellEntry to the cloud file is denied PowerShell

Entry to the cloud file is denied PowerShell


Entry to the cloud file is denied‘ whereas putting in a PowerShell module?

The error ‘Entry to the cloud file is denied‘ makes you assume it’s the PowerShell Gallery, however it’s most likely your OneDrive and the situation of your $env:PSModulepath after which most likely together with the -Scope CurrentUser parameter and variable.

There are a number of issues you may attempt.
See the headers for various options.


FIX 1: With administrator permissions

What helped me have been the next steps:

  • Open PowerShell as Administrator
  • Run the next cmdlet (change to the proper module title)
Set up-Module -Identify Az

Because you don’t use the -Scope CurrentUser, PowerShell mechanically grabs a unique path in your $env:PSModulePath.
If you wish to learn extra about this, it’s finest to go to this part ‘Home windows PowerShell startup‘.


FIX 2: With disabling Recordsdata On-Demand in OneDrive

Not everybody has administrator rights on their system, however as a result of the above step already labored for me, it’s tough to troubleshoot additional, however what I’m guessing the issue is is the OneDrive information On-Demand perform.

You’ll be able to disable this by opening the Settings of OneDrive and going to the Settings tab. Below Recordsdata On-Demand you may disable the choice.

FIX: Install-Package: Access to the cloud file is denied PowerShell
FIX: Set up-Package deal: Entry to the cloud file is denied PowerShell

Home windows PowerShell startup

Home windows PowerShell makes use of the next logic to assemble the PSModulePath at startup:

  • If PSModulePath doesn’t exist, mix CurrentUserAllUsers, and the $PSHOME modules paths
  • If PSModulePath does exist:
    • If PSModulePath incorporates $PSHOME modules path:
      • AllUsers modules path is inserted earlier than $PSHOME modules path
    • else:
      • Simply use PSModulePath as outlined because the consumer intentionally eliminated the $PSHOME location

The CurrentUser module path is prefixed provided that Consumer scope $env:PSModulePath doesn’t exist. In any other case, the Consumer scope $env:PSModulePath is used as outlined.

Supply: about PSModulePath – PowerShell | Microsoft Docs

So the construction of my $env:PSMODULEPATH is as follows:

$env:PSMODULEPATH

C:UsersBasWijdenesOneDriveDocumentsWindowsPowerShellModules;C:Program FilesWindowsPowerShellModules;C:WINDOWSsystem32WindowsPowerShellv1.0Modules

That is an Array containing the CurrentUser, AllUsers, $PSHOME modules places from left to proper.

My $PSHOME seems to be like this (So, for the PowerShell module path it will add Modules):

$PSHOME

C:WindowsSystem32WindowsPowerShellv1.0

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments