SetupComplete.cmd not executing

dansutton24

New Member
Hi, I’m fairly new to using NTLite and am currently working on an image that executes 2 scripts after setup. 1 needs internet to run. I am using a Windows 11 Enterprise iso. The issue I am having is once the setup completes, the post setup commands don’t execute - I am guessing this is as windows has automatically activated. I have tested without internet and this executes fine - of course failing as the script requires internet.

I’ve read that the setupcomplete.cmd should execute if using Windows 11 Enterprise but did notice posts in the forum saying that the box under unattended for OEM SetupComplete needs to be checked in most cases so it can run. This option isn’t available under unattended for me. Is there any other way for this to be done?
 
Latest NTLite version should not have any issues executing post-setup.
Didn't understand the "I have tested without internet and this executes fine", does that mean it's not the issue with Post-setup, but that you need internet working before it?
In that case try the After logon portion, or if it's WIFI you can integrate a script which restores connection, we can talk about that if it is the case here.

If the Before logon post-setup still does not execute, please provide a way how to confirm that issue, be it a command, a script or an installer which should have installed.
 
Latest NTLite version should not have any issues executing post-setup.
Didn't understand the "I have tested without internet and this executes fine", does that mean it's not the issue with Post-setup, but that you need internet working before it?
In that case try the After logon portion, or if it's WIFI you can integrate a script which restores connection, we can talk about that if it is the case here.

If the Before logon post-setup still does not execute, please provide a way how to confirm that issue, be it a command, a script or an installer which should have installed.
Thanks for the response nuhi. I have a folder added to the machine section which adds PSTools to the machine and then 2 scripts which are added to the user section which I would expect to run after the machine logs in.

The PSTools folder is added without issue as expected but the scripts don’t seem to run after connecting to WiFi at OOBE. The scripts run fine and I can see them after login when not connected to the internet but installing Windows and connecting to the internet, they don’t run after the account logs in.

Might be a Windows issue more than NTLite?
 
nuhi, we need you to explain what was intended in this NTLite redesign.

The current advice for adding a Wi-Fi profile under the old NTLite:
Code:
netsh wlan add profile filename="%WINDIR%"\Setup\Files\profile.xml user=all

But now, when you add profile.xml, it's moved to:
Code:
"%SYSTEMROOT%\Setup\profile.xml"

Is backwards compatibility gone? If that's the case, it needs to be clearly highlighted.
 
Thanks for the response nuhi. I have a folder added to the machine section which adds PSTools to the machine and then 2 scripts which are added to the user section which I would expect to run after the machine logs in.

The PSTools folder is added without issue as expected but the scripts don’t seem to run after connecting to WiFi at OOBE. The scripts run fine and I can see them after login when not connected to the internet but installing Windows and connecting to the internet, they don’t run after the account logs in.

Might be a Windows issue more than NTLite?
Are you saying MSAccount is not supported by Post-setup - After logon?
Or you're using the local account?
There is no reason for commands not to run, if they ran without the internet, only quirk could be that MS Account type is different.

On a potentially separate note, even though I don't think the topic here is the internet connection itself:
If you used WIFI profile as garlin mentioned, make sure to correct the path in the netsh command, to the UI specified in the profile.xml row after adding it to the list.
"%SYSTEMROOT%\Setup\profile.xml" is now the default.

garlin, if you can update your WIFI profile guide, that would be great, I don't recall having my own somewhere.
I'll for sure update the site these days to reflect new post-setup changes.
 
I may have warned you this might happen when changing file handling. Backwards compatibility is imperative because we have too much user experience ingrained in "\Windows\Setup\Files".

If you're placing files in newly created presets to "\Windows\Setup" that's fine, but you really need to put a Files folder symlink pointing back up one level for compatibility reasons. Unless you want to actively fix every old preset after loading and remove "\File\..". Not to mention a number of user contributed scripts which all expect to use "\Windows\Setup\Files".

There's a ridiculous number of threads out there which are now broken unless the Files symlink gets implemented in the next release.
 
The post-setup issues were due to the quick change of the post-oobe script call, which silly me didn't test properly.
I forgot to rename setupcomplete.cmd during testing, to emulate OEM machines, and of course it worked.

Corrected the calls now in the build 9832+, post-setup before-logon should work again for OEM machines as well.

That said, I think this topic is about MSAccount, not about wifi preset path, nor it's a big deal for people to adjust location to the new system where they can choose where to save files anyway.

Updated your guide here.
 
Hi nuhi - thanks for the updates here. I’ll be testing again next week so will come back if I have any further issues.

This was just using a local account so don’t think it’s related to the MS Account. This wasn’t signed in to an MS Account at any point. Wi-Fi was also just connected at OOBE so not related to this either.

Just to confirm, how are the scripts actually ran after logon? I was under the impression that setupcomplete.cmd runs these but this runs straight after the OOBE so this would be before logon meaning the machine post setup runs at this point. Is there something else executed after logon which runs the user post setup executing these scripts?

Just trying to gain a better understanding of what actually runs at what stage and how these run.
 
Machine tasks are executed after OOBE, from a Windows built-in task queue in the registry that runs SetupComplete.cmd.

User tasks are executed after the primary user's first desktop logon, from a RunOnceEx registry key. The major difference is because you're logged on, user profile settings are now available for modification. These tasks run with Admin rights, but under your profile.

Tasks which update your profile, or need user interaction (you clicking on some app screen) need to run under Post-Setup (User).
 
Machine tasks are executed after OOBE, from a Windows built-in task queue in the registry that runs SetupComplete.cmd.

User tasks are executed after the primary user's first desktop logon, from a RunOnceEx registry key. The major difference is because you're logged on, user profile settings are now available for modification. These tasks run with Admin rights, but under your profile.

Tasks which update your profile, or need user interaction (you clicking on some app screen) need to run under Post-Setup (User).
Thanks for the info garlin. Appreciate it!
 
Back
Top