VMware Cloud Community
tjc516
Contributor
Contributor

Receiving Access Denied when Installing PowerCLI

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.

Reply
0 Kudos
14 Replies
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tjc516
Contributor
Contributor

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.

Reply
0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tjc516
Contributor
Contributor

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

Reply
0 Kudos
LucD
Leadership
Leadership

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?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tjc516
Contributor
Contributor

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.

Reply
0 Kudos
LucD
Leadership
Leadership

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

Install-Module –Name PowerShellGet –Force

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

Install-PackageProvider Nuget –Force


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tjc516
Contributor
Contributor

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

Reply
0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tjc516
Contributor
Contributor

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

Reply
0 Kudos
LucD
Leadership
Leadership

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
tjc516
Contributor
Contributor

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.

Reply
0 Kudos
tjc516
Contributor
Contributor

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.

Reply
0 Kudos
LucD
Leadership
Leadership

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

Great, glad you found the issue.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos