2

Troubleshooting i tried uninstalling nuget. NuGetProvider-2.8.5.208.dll to be specific. I have never worked with Power Shell before and am totally lost. I found this question that helped me find nuget and create a command to delete it.

But I'm unable to follow through. I did start powershell as administrator.

Here the input:

(Get-PackageProvider|where-object{$_.name -eq "nuget"}).ProviderPath|Remove-Item -force Restart-Computer

The error message:

    Remove-Item : The input object cannot be bound to any parameters of the command because the command does not accept pipeline input or the input and its properties do not match any of the parameters that accept pipeline input.
and its properties do not match any of the parameters that accept pipeline input.
line:1 character:70
+ ... _.name -eq "nuget"}).ProviderPath|Remove-Item -force Restart-Computer
+                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (C:\Users\XXX ...GetProvider.dll:String) [Remove-Item], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.RemoveItemCommand

How can i solve this and successfully uninstall it?


Thanks for your answer! Still no luck. Here the error:

Remove-Item : The element C:\Users\XXX\AppData\Local\PackageManagement\ProviderAssemblies\nuget\2.8.5.208
\Microsoft.PackageManagement.NuGetProvider.dll cannot be removed: Access to the path "C:\Users\XXX\AppData\Local\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvide
r.dll" denied.
Line:1 Character:44
+ (Get-PackageProvider NuGet).ProviderPath | Remove-Item -Force
+                                            ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\XXX ...GetProvider.dll:FileInfo) [Remove-Item], Unauthoriz
   edAccessException
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
Machavity
  • 30,841
  • 27
  • 92
  • 100
  • The answer from the linked post you took your code from was poorly formatted (since fixed), which made you miss a required line break before `Restart-Computer`. That said, restarting the _computer_ shouldn't be necessary - starting a _new session_ should suffice. I've posted an answer with detailed steps [here](https://stackoverflow.com/a/71315138/45375). – mklement0 Mar 01 '22 at 22:11
  • Thanks for your answer! Still no luck. Clarification follows. – StackingTheStacks Mar 02 '22 at 10:35
  • Your error suggests that you didn't run the command _with elevation_ (as admin). The linked answer tells you how to do that (you must either be part of a an administrator group yourself or know administrative credentials to open an elevated session). – mklement0 Mar 02 '22 at 13:24
  • I did. I did even first start power shell as an admin, and fallowed the instructions exactly. I have full rights over the machine and have every credential for the system. – StackingTheStacks Mar 02 '22 at 14:12
  • Good point - I had only tested on macOS. Please see the updated answer. In short: on Windows you must ensure that the DLL to delete _isn't loaded_ in any session. If it is, you'll get an `Access denied` error, even with elevation. – mklement0 Mar 02 '22 at 15:20

0 Answers0