Closed Sn00zEZA closed 1 year ago
I originally find the following error: PS C:\Temp> C:\Temp\Reset-Appx.ps1 * Starting processing the script Testing the WinGet package and other dependancies are installed The 'winget.exe' binary was found at 'C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.19.11071.0_x64_8wekyb3d8bbwe\WinGet.exe' The WinGet binary was validated WinGet version is 'v1.4.11071' Processing AppxPackage: Microsoft.CompanyPortal Did not attempt removal of the AppxPackage 'Microsoft.CompanyPortal' because it was not found Did not attempt removal of the AppxProvisionedPackage 'Microsoft.CompanyPortal' because it was not found Checking if 'Company Portal' is installed using Id '9WZDNCRFJ3PZ'... winget.exe list --id 9WZDNCRFJ3PZ --source msstore --accept-source-agreements WARNING: Error while running the WinGet command line to check if 'Company Portal' is already installed WARNING: Cannot process argument because the value of argument "path" is null. Change the value of argument "path" to a non-null value. Checking if 'Company Portal' is installed using Get-AppXPackage... Get-AppXPackage -AllUsers | Where-Object { $.Name -like "Microsoft.CompanyPortal*" } -ErrorAction Stop Finished processing the script
The fix is to pass the winGetPath as $global:winGetPath
Thanks, silly omission on my part, I wonder how this passed my testing :(
1.06.20.0 - Bug Fixes
With the current release the 1.06.18.0, the $winGetPath variable is null in the Install-WinGetApp function. WARNING: Cannot process argument because the value of argument "path" is null. Change the value of argument "path" to a non-null value.
Fixed by changing the function Test-WinGet to the following: try { $global:winGetPath = (Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq $winGetPackageName }).InstallLocation | Sort-Object -Descending | Select-Object -First 1 } catch {