Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sysprep warning message in 8.5.2 #29

Open
donho opened this issue Apr 13, 2023 · 49 comments
Open

Sysprep warning message in 8.5.2 #29

donho opened this issue Apr 13, 2023 · 49 comments
Assignees

Comments

@donho
Copy link
Member

donho commented Apr 13, 2023

SYSPRP Package NotepadPlusPlus_1.0.0.0_neutral__7njy0v32s6xk6 was installed for a user, but not provisioned for all users.
https://community.notepad-plus-plus.org/topic/24345/notepad-v8-5-2-release/19?_=1681357704510

Not sure if it’s NppShell issue though.
What do you think @GurliGebis ?

@GurliGebis
Copy link
Contributor

It is the same as when we try to install it for all users.
Sysprep complains that the package isn't installed for all users - so when the image they make is installed, the new user will not be have the package installed.

However, the multi-user fix we did earlier this week also works there. So the first time they right click a file after they create the user, it will be there.

This requires 8.5.3 though, so the version they are using (8.5.2) doesn't do that 🙂

@donho
Copy link
Member Author

donho commented Apr 14, 2023

@GurliGebis

This requires 8.5.3 though, so the version they are using (8.5.2) doesn't do that

Sorry I don't follow you - what's in v8.5.3 makes difference?

It is the same as when we try to install it for all users.
Sysprep complains that the package isn't installed for all users - so when the image they make is installed, the new user will not be have the package installed.

So if I understand correctly, while installer registering NppShell.dll for the Adm user, Sysprep has detected it and complains? If it is, Sysprep will always complain with our current solution (installing for user on the first use), won't it?

@GurliGebis
Copy link
Contributor

@donho in the test builds we have now, this code exists:

thread ensureRegistrationThread = thread(EnsureRegistrationOnCurrentUserWorker);

Sysprep complains that the package is only installed for a normal user, and not provisioned for everyone (which is what you cannot do for a sparse package - or to be more specific, you can do it, but it doesn't get installed for other users when they log in).
So since the code I link above exists, they should just ignore the warning from sysprep, since we handle registering the package for new users at the first right click on a file.

@donho
Copy link
Member Author

donho commented Apr 14, 2023

@GurliGebis

So since the code I link above exists, they should just ignore the warning from sysprep, since we handle registering the package for new users at the first right click on a file.

So TEST20 should fix it, shouldn't it?

@GurliGebis
Copy link
Contributor

@donho it will make sure it is installed for the user on first right click.
It won't prevent sysprep from showing that warning, since it will complain about it, but the warning can be safely ignore, since it is working as intended

@donho
Copy link
Member Author

donho commented Apr 14, 2023

@GurliGebis

it will make sure it is installed for the user on first right click.

You mean on the 2nd right click, right?

It won't prevent sysprep from showing that warning, since it will complain about it, but the warning can be safely ignore, since it is working as intended

OK, thank you for your answer.

@GurliGebis
Copy link
Contributor

@donho on the first right click, it will trigger the install of the msix package, so it will be there on the second right click 🙂

@donho
Copy link
Member Author

donho commented Apr 15, 2023

@GurliGebis

@donho on the first right click, it will trigger the install of the msix package, so it will be there on the second right click 🙂

Yes, sure. Sorry for misreading. Thank you for the reply.

@GurliGebis
Copy link
Contributor

🙂

@Hammerfest
Copy link

Hammerfest commented Apr 22, 2023

Thanks everyone for reporting this error, I was just building new images for family systems updating to 11 and kept running into this error when trying to sysprep generalize when it worked without issue a few months ago!

Looks like it will be resolved in 8.5.3 so I will keep an eye out and test when it drops!

EDIT: if TEST20 is supposed to resolve the issue, it does not, this PREVENTS sysprep generalize from completing.

@GurliGebis
Copy link
Contributor

@Hammerfest sysprep fails if a package is provisioned for the user but not the system?

@Hammerfest
Copy link

Hammerfest commented Apr 28, 2023

Correct, exact message at the opening comment

2023-04-22 15:45:17, Error                 SYSPRP Package NotepadPlusPlus_1.0.0.0_neutral__7njy0v32s6xk6 was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
2023-04-22 15:45:17, Error                 SYSPRP Failed to remove apps for the current user: 0x80073cf2.
2023-04-22 15:45:17, Error                 SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
2023-04-22 15:45:17, Error                 SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:\Windows\System32\AppxSysprep.dll; dwRet = 0x3cf2
2023-04-22 15:45:17, Error                 SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x3cf2
2023-04-22 15:45:17, Error                 SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x3cf2
2023-04-22 15:45:17, Error      [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
2023-04-22 15:45:17, Error      [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2

@GurliGebis
Copy link
Contributor

@Hammerfest can you try this, and then run sysprep again:
Get-AppxPackage -Name *NotepadPlusPlus* | Remove-AppxPackage

@GurliGebis
Copy link
Contributor

The package will be reinstalled automatically

@Hammerfest
Copy link

This worked, it should be noted however that if you create a template user (not done often by many) it will need to be done on both the user and sysprep account or it will still fail.

Might be to much of a PITA to properly resolve this to simply install upon account creation or provide an integration pack like Microsoft does for some of its tools.

@GurliGebis
Copy link
Contributor

@Hammerfest the problem is that provisioning the package on a system level doesn't work for sparse package, so we simply cannot do that.
For it to work, the entire NPP setup should be moved into an MSIX package instead, but that is not happening right now at least.

@levicki
Copy link

levicki commented Jun 16, 2023

@GurliGebis

It won't prevent sysprep from showing that warning, since it will complain about it, but the warning can be safely ignore, since it is working as intended

I don't know with what authority you are saying the bolded part, but your claim is totally incorrect.

Sysprep is not issuing a warning which can be ignored — it is throwing an error since it fails to reseal the image to OOBE state because of this improperly provisioned package.

When we are at the subject of that package, I don't like how it is done silently without notifying the user that it is being installed. Such behavior is always automatically associated in my head with malware.

I don't know what is the purpose of that package (and frankly I don't care because it seems to work for me without it), but if it interferes with sysprep it will prevent staging Notepad++ in a Windows image and leave many people scratching their head as to where it came from.

Changes like this should be properly tested or at least announced clearly in release notes — you can't expect people to come read the commit logs and merge / pull requests on GitHub to find out stuff like that.

@GurliGebis
Copy link
Contributor

@levicki the problem is that you cannot provision a sparse package on the machine level, since it doesn't get installed by the user.
Which is why we have to register the package for the user once they log in, since that is the way it can be done.

I don't know why Microsoft hasn't implemented the logic to allowed provisioning sparse packages.
If Notepad++ was delivered using the store instead, it should have worked, since it would be possible to provision it for everyone.

@levicki
Copy link

levicki commented Jun 19, 2023

@GurliGebis

I understood that much.

What I didn't understand is what problem is using a sparse package trying to solve in the first place? Is it registering the shell extension per user?

If so, then why not just use the HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components registry key?

An example of Brave doing just that:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{AFE6A462-C574-4B8A-AF43-4CC60DF4563B}]
@="Brave"
"StubPath"="\"C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\114.1.52.126\\Installer\\chrmstp.exe\" --configure-user-settings --verbose-logging --system-level"
"Localized Name"="Brave"
"IsInstalled"=dword:00000001
"Version"="43,0,0,0"

So for example you could do (I generated random GUID, you could use the ProductID if you are using MSI installer):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{61C3E878-1CE2-4E1D-B791-66494FB43BD7}]
@="Notepad++"
"Version"="1"
"StubPath"="C:\\Windows\\System32\\regsvr32.exe /s /i \"C:\\Program Files\\Notepad++\\NppShell_06.dll\""

That will get executed for each new user only once, after that the corresponding mirror of the HKLM key will be created in HKCU and marked as installed so it won't be run again if the exact match is found. Afterwards if you want to re-run it you just increase version number.

Note that if you want multipart version number (like Brave uses above) you must use comma (,) as a separator, not a dot (.).

More details here and on Google of course.

TL;DR — If you are a desktop application then work like a desktop application, and if you are a store application then make a proper MSIX package that can be provisioned for all users instead of mixing apples and oranges.

@donho
Copy link
Member Author

donho commented Jun 30, 2023

@GurliGebis
Is it possible (doable) to integrate the solution suggested by Luper?
https://community.notepad-plus-plus.org/topic/24591/notepad-v8-5-4-release/4?_=1688091290446

@donho donho changed the title Wired message in 8.5.2 Sysprep warning message in 8.5.2 Jun 30, 2023
@donho donho self-assigned this Jun 30, 2023
@levicki
Copy link

levicki commented Jun 30, 2023

@donho I don't think that's possible, @GurliGebis said sparse package cannot be provisioned on the system level.

It's much easier to do this using the Active Setup registry key instead of building an appx as I have explained in the post above yours.

If you really want to go the Store route, then you should make whole Notepad++ into an appx/msix that can be provisioned into the image for all users instead of having to run regular setup, and then we won't be having this problem.

As I said, you are either a desktop app or a store app. You can't really be both (well technically you can skirt it, but it will just give you and the users headaches).

@GurliGebis
Copy link
Contributor

@donho from what I tried earlier, when we had to find a solution for installing it for all users on the system, it seems like it just doesn't work.
It registers the package just fine, but it never gets installed for any users.
It might be me doing something wrong, since I wasn't able to find any documentation or examples (or other people on github doing it) - it's difficult to know 🙂
That is way we have to do it this way (which is sub-optimal, but at least works).
The only problem is for people using sysprep, since they have to unregister the package before sysprepping the installation. (It will be registered for each user on first right click like as usual afterwards)

@Neustradamus
Copy link

To follow

@rgb99
Copy link

rgb99 commented Aug 10, 2023

need to be done on both the user and sysprep account

@Hammerfest How, exactly? I installed NPP as Administrator in Audit Mode -- there are no other accounts. Running Get-AppxPackage -Name *NotepadPlusPlus* | Remove-AppxPackage then running sysprep works after installing 8.5.2, but when doing the same thing on newer versions of NPP, sysprep failed following Remove-AppxPackage.

@Hammerfest
Copy link

I haven't tried with anything past 8.5.3, its possible something changed
When I mentioned user I meant if you made a template user account (something I do so layouts, theme settings stick to any new user created), you can ignore that if you did not/do not do this.

Outside of that the process was reboot into audit mode from OOBE, install programs, restart, run command, then perform sysprep shutdown to OOBE, I wanna say if you restart at all after running the command to remove the package it re-installs on next login of the account

I need to make a new image, will try that this weekend.

@rgb99
Copy link

rgb99 commented Aug 10, 2023

@Hammerfest Thanks for the quick reply! In my case, it's for VMware Horizon (VDI), non-persistent desktops. I can confirm that the AppxPackage comes back during the next logon, but in my experience, removing the package and then running sysprep immediately after (on NPP 8.5.3 and newer) failed.

When we update the Desktop Pools later this month, the machine will have NPP 8.5.2 on it. NPP is already up to 8.5.5 and the sysprep issue is not resolved. Hopefully, it will be, sooner than later!

@benlye
Copy link

benlye commented Aug 10, 2023

@Hammerfest Thanks for the quick reply! In my case, it's for VMware Horizon (VDI), non-persistent desktops. I can confirm that the AppxPackage comes back during the next logon, but in my experience, removing the package and then running sysprep immediately after (on NPP 8.5.3 and newer) failed.

I'm also building images for a VMware Horizon VDI environment. I have an automated build process which builds and deploys our golden image templates. I just checked last night's build and it worked fine with NPP 8.5.4 in the image.

The build uses Chocolatey to install NPP and then removes the AppX pacakge:

choco install notepadplusplus.install -y
Get-AppxPackage NotepadPlusPlus | Remove-AppXPackage

The Horizon customization process ran fine afterwards.

@rgb99
Copy link

rgb99 commented Aug 10, 2023

@benlye That is great to know! It's a manual process for us, so we'll have to try 8.5.4 next month.

@rgb99
Copy link

rgb99 commented Sep 18, 2023

Notepad++ 8.5.7 addresses some bad vulnerabilities. However, after running the Remove-AppxPackage command, sysprep still breaks. Is there a way to fix this? @benlye , have you come across this?

@benlye
Copy link

benlye commented Sep 18, 2023

Notepad++ 8.5.7 addresses some bad vulnerabilities. However, after running the Remove-AppxPackage command, sysprep still breaks. Is there a way to fix this? @benlye , have you come across this?

My build process appears to be working fine with NPP 8.5.7 using the Remove-AppXPackage mitigation.

@rgb99
Copy link

rgb99 commented Sep 18, 2023

@benlye Lucky you! I rebooted the image. After a few minutes, the package came back so I removed it again with the command, and then Generalize via OSOT worked. I don't understand... but I'll take it.

@AlonzoMoselyFBI
Copy link

@Hammerfest can you try this, and then run sysprep again: Get-AppxPackage -Name *NotepadPlusPlus* | Remove-AppxPackage

I created a github account just to thank you for this - fixed my issue. Thank you!

@brentil
Copy link

brentil commented Mar 20, 2024

I wanted to report we're seeing this still with 8.6.4 as we're building our first Windows 11 sysprep image. I can run the command above but I have to immediately sysprep the system otherwise it will re-inject the Appx within minutes. Would it be possible to when the application is installed as admin to provision the Appx to all users instead of just the installed one? That would solve this issue. Or provide the ability to add a flag to disable this behavior for image based systems?

The extra frustrating part is we've disable the new Windows 11 right click menu to use the Windows 10 style one so the Appx package isn't even needed.

@GurliGebis
Copy link
Contributor

@brentil That does not work for some reason.
We have tried pretty much everything - the API calls return just fine, and shows the package as provisioned for all users - but no users get it installed when they log in (not even the user that does the provisioning for all users).
I would suspect this is due to the package not being from the store, but I can only guess.

@OrionWithrow-OHIT
Copy link

OrionWithrow-OHIT commented May 15, 2024

Still struggling with this on W11 23H2, using NPP 8.6.7. Was working at one point with a previous version. If I revert to version 8.4.9, works perfectly!

@BrendenWalker
Copy link

Same problem here with 8.6.7 trying to syspred an Azure VM.

Running Get-AppxPackage | findstr /I "note" from admin PS returns no notepad++ packages installed.

Tried various versions of Remove-AppxPackage including running for each user.

Deleted all remants in registry and on local filesystem, and still getting:

2024-06-06 17:39:39, Error SYSPRP Package NotepadPlusPlus_1.0.0.0_neutral__7njy0v32s6xk6 was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.

I got this to work yesterday on a VM created via the same snapshot from the same VM source... so I'm not sure what the heck is going on... Just adding my notes to this in case there's anything useful.

@OrionWithrow-OHIT
Copy link

OrionWithrow-OHIT commented Jun 6, 2024 via email

@jlsupremo1
Copy link

jlsupremo1 commented Oct 24, 2024

Yes, this happened after the option to edit using the reverse button was included in Windows. Versions that did not have this option are free from this problem with sysprep. Can the programmers help make a version with this fix? I really need Notepadd++ on my versions of Windows using sysprep, but I'm having to use the npp.8.5.Installer.x64.exe version that did not have this option yet. If I install the new version, this problem occurs.
I just tried with Notepad++ v8.7 on Windows 11 24H2, still the same problem when generalizing sysprep it presents the error, canceling the windows sysprep.

2024-10-24 11:17:30, Error SYSPRP Package NotepadPlusPlus_1.0.0.0_neutral__7njy0v32s6xk6 was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
2024-10-24 11:17:30, Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
2024-10-24 11:17:30, Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
2024-10-24 11:17:30, Error SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:\Windows\System32\AppxSysprep.dll; dwRet = 0x3cf2
2024-10-24 11:17:30, Error SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x3cf2
2024-10-24 11:17:30, Error SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x3cf2
2024-10-24 11:17:30, Error [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
2024-10-24 11:17:30, Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2

@brentil
Copy link

brentil commented Oct 24, 2024

I really need Notepadd++ on my versions of Windows using sysprep, but I'm having to use the npp.8.5.Installer.x64.exe version that did not have this option yet. If I install the new version, this problem occurs. I just tried with Notepad++ v8.7 on Windows 11 24H2, still the same problem when generalizing sysprep it presents the error, canceling the windows sysprep.

@jlsupremo1 all you have to do to fix it with a newer version of Notepad++ is to remove the Appx right before you call sysprep. Just don't right click on anything between that and running sysprep because it'll re-inject it again...

Get-AppxPackage -Name NotepadPlusPlus | Remove-AppXPackage

@jlsupremo1
Copy link

I didn't understand, but removing this (Get-AppxPackage -Name NotepadPlusPlus | Remove-AppXPackage) doesn't affect notepad++ after reconfiguring windows? Isn't it missing a component or itself?

I really need Notepadd++ on my versions of Windows using sysprep, but I'm having to use the npp.8.5.Installer.x64.exe version that did not have this option yet. If I install the new version, this problem occurs. I just tried with Notepad++ v8.7 on Windows 11 24H2, still the same problem when generalizing sysprep it presents the error, canceling the windows sysprep.

@jlsupremo1 all you have to do to fix it with a newer version of Notepad++ is to remove the Appx right before you call sysprep. Just don't right click on anything between that and running sysprep because it'll re-inject it again...

Get-AppxPackage -Name NotepadPlusPlus | Remove-AppXPackage

@brentil
Copy link

brentil commented Oct 25, 2024

No, all it's doing is removing the Windows 11 right click injection application, it's not Notepad++ you're removing. That injection app is what's causing the sysprep issues and not Notepad++ itself.

@oranmizrahi
Copy link

So what to do to fix this problem?

@GurliGebis
Copy link
Contributor

@oranmizrahi run the Remove-AppXPackage, followed by sysprepping the image.

@oranmizrahi
Copy link

@oranmizrahi run the Remove-AppXPackage, followed by sysprepping the image.

I already ran Remove-AppxPackage and attempted to Sysprep the image, but it didn't work. Notepad++ still shows up when checking with Get-AppxPackage -AllUsers -Name NotepadPlusPlus.

@oranmizrahi
Copy link

image

@GurliGebis
Copy link
Contributor

Then restart, and it will be removed - just don't right click in explorer, since that will trigger the reinstall.

@oranmizrahi
Copy link

oranmizrahi commented Nov 5, 2024

Then restart, and it will be removed - just don't right click in explorer, since that will trigger the reinstall.

Thank you, it really worked! Notepad wasn’t the only package causing issues.

If someone else encounter problems with residual Appx packages, follow these steps to ensure complete removal:

  1. Check if the Package Exists: Use Get-AppxPackage -AllUsers -Name PackageNameChangeMe.
  2. Remove the Package: Use Get-AppxPackage -AllUsers -Name PackageNameChangeMe | Remove-AppxPackage -AllUsers.
  3. Remove the Provisioned Package: Use Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -like "PackageNameChangeMe"} | Remove-AppxProvisionedPackage -Online

@DamienDennehy
Copy link

DamienDennehy commented Nov 23, 2024

This issue is also present in Windows Server 2025.

We use chocolatey & packer so restarting before the sysprep resolved it along with the Remove-AppxPackage call.

# Install Notepad++
  provisioner "powershell" {
    script = "${path.root}/scripts/install-notepadplusplus.ps1"
  }
# Restart before final prep
  provisioner "windows-restart" {}
choco install notepadplusplus
Get-AppxPackage -Name *NotepadPlusPlus* | Remove-AppxPackage

@brentil
Copy link

brentil commented Nov 24, 2024

Could we maybe get a command line switch for the installer to disable the installation of AppxPackage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests