byteben / MEM

40 stars 8 forks source link

Company Portal only available every second run of the script #7

Closed SamBlaettler closed 1 year ago

SamBlaettler commented 1 year ago

The script gets better and better, like that! But I have still an issue:

I ran the latest available version of your script (1.06.27.0) and it ran without error, Company Portal was there and winget also showed that the app was installed in machine scope.

Then I ran the script a second time. Again, no errors. But Company portal was not there from the start menu. Winget still showed that it is installed in machine scope.

Then I ran the script a third time, and now, Company Portal showed up again for the logged in user.

Running it a fourth time broke CP again, had to run the script again to fix the issue. Reset-Appx.log

SamBlaettler commented 1 year ago

Looks to me that if Company Portal is already installed in device context and the script tries to uninstall/reinstall it, that this breaks the App.

If the script would check at the beginning if Company Portal is already installed in machine scope and quits in this case, everything would be fine. Or am I missing something?

byteben commented 1 year ago

Found the root cause and a fix is inbound for v2

SamBlaettler commented 1 year ago

Hi Ben

Ran the script as part of an Autopilot-enrollment and got the following error on first run:

image

Attaching also the full log for your reference

z22kk commented 1 year ago

Hi Ben

Ran the script as part of an Autopilot-enrollment and got the following error on first run:

image

Attaching also the full log for your reference

why would you use the script while deploying new devices? this script should benefit users who already had the CP installed in user context. just deploy the CP in system context with the new store app.

byteben commented 1 year ago

Thanks. Winget will install the appxprovisioned package but if it gets staged or the manifest fails to register you end up with inconsistent detection states. I know how to track and remediate these and will hopefully have an update the weekend

Ben Whitmore Enterprise Mobility MVP


From: z22kk @.> Sent: Friday, June 30, 2023 12:24:51 PM To: byteben/MEM @.> Cc: Ben Whitmore @.>; Comment @.> Subject: Re: [byteben/MEM] Company Portal only available every second run of the script (Issue #7)

Hi Ben

Ran the script as part of an Autopilot-enrollment and got the following error on first run:

[image]https://user-images.githubusercontent.com/130731400/250043398-6744b49c-0041-4ef0-ae52-674bbf4bb9bd.png

Attaching also the full log for your reference

why would you use the script while deploying new devices? this script should benefit users who already had the CP installed in user context. just deploy the CP in system context with the new store app.

— Reply to this email directly, view it on GitHubhttps://github.com/byteben/MEM/issues/7#issuecomment-1614516807, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKSAHIEYM73SCG6GRNGFI33XN2ZQHANCNFSM6AAAAAAZXBSUBU. You are receiving this because you commented.Message ID: @.***>

byteben commented 1 year ago

Hey,

You don't need this script during autopilot. It's only needed to fix an issue where you are deploying the CP as system to devices that already have the CP installed in the user context.

Your failure above is because the winget dependencies are not accessible as system, so the required assemblies must be present. In your case VC++ 14.c needs to be installed.

Ben Whitmore Enterprise Mobility MVP


From: Ben Whitmore @.> Sent: Friday, June 30, 2023 12:26:39 PM To: byteben/MEM @.>; byteben/MEM @.> Cc: Comment @.> Subject: Re: [byteben/MEM] Company Portal only available every second run of the script (Issue #7)

Thanks. Winget will install the appxprovisioned package but if it gets staged or the manifest fails to register you end up with inconsistent detection states. I know how to track and remediate these and will hopefully have an update the weekend

Ben Whitmore Enterprise Mobility MVP


From: z22kk @.> Sent: Friday, June 30, 2023 12:24:51 PM To: byteben/MEM @.> Cc: Ben Whitmore @.>; Comment @.> Subject: Re: [byteben/MEM] Company Portal only available every second run of the script (Issue #7)

Hi Ben

Ran the script as part of an Autopilot-enrollment and got the following error on first run:

[image]https://user-images.githubusercontent.com/130731400/250043398-6744b49c-0041-4ef0-ae52-674bbf4bb9bd.png

Attaching also the full log for your reference

why would you use the script while deploying new devices? this script should benefit users who already had the CP installed in user context. just deploy the CP in system context with the new store app.

— Reply to this email directly, view it on GitHubhttps://github.com/byteben/MEM/issues/7#issuecomment-1614516807, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKSAHIEYM73SCG6GRNGFI33XN2ZQHANCNFSM6AAAAAAZXBSUBU. You are receiving this because you commented.Message ID: @.***>

SamuelBlaettler commented 1 year ago

Your're right, this makes no sense. I install Company Portal for this device as well as App, but it looks like the powershell run command is quicker than the App deployment. Will now add the App to the list of required Apps in ESP to ensure that it is already installed once the enrollment takes place.

byteben commented 1 year ago

All 3 conditions listed below are fixed in V1.07.03.0 of Reset-Appx.ps1 Bug Fixes, Enhancements and Refactoring 🪲🌟🧑‍💻

Condition 1: When WinGet installs the app as SYSTEM, the AppxPackage can fail to register so the AppxPackage regresses, resulting in the ap not being available for the user.

Condition 2: The AppxPackage was staged as SYSTEM

Condition 3: After the WinGet install, WinGet list did not detect the app

WinGet will retry 10 times (by default) to install the app successfully and ensure the conditions above are not present. There is also a 30 second wait (by default) when testing the AppxPackage after WinGet has installed the app