0
votes

I get this error:

PackageManagement\Install-Package : Could not find a part of the path 'C:\Users\MB\Documents\WindowsPowerShell\Modules\Az.Accounts\1.7.1'. 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], Exce ption + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand,Micro soft.PowerShell.PackageManagement.Cmdlets.InstallPackage

1
You need to provide what steps you have done and which document you followed.Charles Xu

1 Answers

0
votes

Your best option here is to start from scratch:

  1. Go to 'C:\Users\MB\Documents\WindowsPowerShell\Modules\' and remove all folders starting with "Az"
  2. Launch PS as admin and update NuGet to latest version:

    Install-PackageProvider -Name NuGet -Force -Scope AllUsers
    
  3. In the same window install latest version of PackageProvider:

    Install-Module -Name PackageManagement -Scope AllUsers -Force -AllowClobber
    
  4. In the same window install latest version of PowerShellGet

    Install-Module -Name PowerShellGet -Scope AllUsers -Force -AllowClobber
    
  5. Install Azure

    Install-Module -Name Az -Scope CurrentUser -Force -Allowclobber