Automation

 View Only
Expand all | Collapse all

Receiving Access Denied when Installing PowerCLI

  • 1.  Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 03:34 PM

    I've searched through all the posts that i could find and cannot find a solution to this error.  I am running Powershell as Administrator.  Any help would be much appreciated.  This started when i tried to upgrade my PowerCLI, i've removed it entirely and tried new install with same error.

    PackageManagement\Install-Package : Package 'VMware.VimAutomation.Core' failed to be installed because: Access to the
    path 'C:\Users\%USER%\AppData\Local\Temp\y4cori3u\net45\Scripts\GuestDiskExpansion_winXPProGuest.bat' 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: (VMware.VimAutomation.Core:String) [Install-Package], Exception
    + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement
    .Cmdlets.InstallPackage

     

    Thank you for any help you have provide.

     

    Added full error messsage.



  • 2.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 03:39 PM

    Did you try to remove that BAT file?
    Or clean up that complete Temp folder?



  • 3.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 03:47 PM

    Yes i did try removing the bat file, and also i cleaned out my Temp folder.  Same error every time but the folder is different.



  • 4.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 04:29 PM

    Did you do a logoff/logon after removing the folder, and before trying an install?



  • 5.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 04:33 PM

    Essentially yes, i rebooted after deleting the contents of the Temp folder.



  • 6.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 04:38 PM

    Not sure I understand the situation.
    You said you removed that Temp folder, does that mean the BAT file is also removed?
    And you get that same error with each new attempt to install PowerCLI?
    And the error mentions different directories each time?



  • 7.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 04:43 PM

    You said you removed that Temp folder, does that mean the BAT file is also removed?  Yes the BAT file was also removed.
    And you get that same error with each new attempt to install PowerCLI? Yes its the same error each time.
    And the error mentions different directories each time? Yes the "Temp\SubDirectory" is different for each install attempt.

     

    Hope this helps, and thank you.



  • 8.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 05:05 PM

    Ok, from the PowerShellGet version in the error message, I can see that this is a rather old version.
    You should try to upgrade PowerShellGet first.
    Try with

    If you get NuGet related errors, try upgrading NuGet first.



  • 9.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 05:13 PM

    I ran both of the commands and then tried to install PowerCLI and received the same error.

     

    PS C:\WINDOWS\system32> Install-Module -Name VMware.PowerCLI -Confirm:$false -AllowClobber -Force

    PackageManagement\Install-Package : Package 'VMware.VimAutomation.Core' failed to be installed because: Access to the path 'C:\Users\%User%\AppData\Local\Temp\qckwthv1\net45\Scripts\GuestDiskExpansion_winXPProGuest.bat' is denied. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34 + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidResult: (VMware.VimAutomation.Core:String) [Install-Package], Exception
    + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement



  • 10.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 05:19 PM

    Very strange.
    I also find it strange that the variable %USer% is in that path.
    I would expect %USERNAME%.



  • 11.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 05:26 PM

    Sorry LucD thats me manually changing my account login to %user%.



  • 12.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 05:39 PM

    I see.

    I did find some mentions of other installation problems (not PowerCLi) when the permissions and/or ownership on C:Users\<Your_username>\AppData\Local\Temp are not set correctly.
    You might want to check those permissions and ownership.



  • 13.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 05:47 PM

    Thanks for trying LucD.  I checked the permissions and System, Administrator and me have full control to the folder, i'm also set as the Owner.  I did change it from read only to RW but that didn't make a change.



  • 14.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 06:00 PM

    Thank you LucD again for the help.  I saw a post to disable anti-virus and that allowed it to install for anyone that has errors in the future.



  • 15.  RE: Receiving Access Denied when Installing PowerCLI

    Posted Nov 22, 2021 06:25 PM

    If it isn't DNS, it's bound to be the AV 

    Great, glad you found the issue.