AgentRev / WindowsAppsUnfukker

PowerShell script to fix WindowsApps-related permission errors and crashes.
The Unlicense
356 stars 20 forks source link

AppData Packages not found: Empty string from (Get-WMIObject Win32_ComputerSystem).UserName #12

Closed smklancher closed 8 months ago

smklancher commented 2 years ago

I wanted to test the script in a VM first and if failed with the error below. From comments on the question here, I understand now that it is because I was on a remote desktop session, so it's not likely to be a common scenario.

If you iterate the user folders in C:\Users\ instead of using Win32_ComputerSystem.UserName, it will fix this as well as support the possibility of multiple windows users. Both edge cases, but a possible improvement.

Thanks for the script!

You cannot call a method on a null-valued expression.
At C:\Downloads\WindowsAppsUnfukker-main\WindowsAppsUnfukker.ps1:186 char:1
+ $Username = (Get-WMIObject Win32_ComputerSystem).UserName.Split('\')[ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

WARNING: AppData Packages not found, please file a GitHub issue here:
https://github.com/AgentRev/WindowsAppsUnfukker/issues
Copy-paste this in the description: C:\Users\\AppData\Local\Packages