Install stuck at "Just a Moment..."

Makkoido

New Member
Messages
8
Reaction score
2
Granted, I was tired, and should have gone to bed, but the last version I created of my ISO got stuck at "Just a Moment..." I was trying to tweak the issues with my post-installation scripts.

Does anyone know where to look to find a likely culprit?
 
When you're stuck, look for any installers or scripts which aren't really running in silent mode. There's really nothing special about Post-Setup (Before logon), it runs as SYSTEM (which has the same level of rights as Admin). But you're not allowed to interact by keyboard or mouse. Anything that has a pop-up dialog on install will hang, because you can't see the dialog or click to dismiss.

You can basically test your Post-Setup without performing an actual install. Open a CMD shell as Admin, run each of the Post-Setup commands by hand. If they complete without any user interaction, then it would have finished Post-Setup without problems.

If you have a batch or PS script, you can change the command to log the error output:

CommandParameters
cmd/c \path\to\myscript.bat 2>&1 > \path\to\log.txt
powershell-nop -ep bypass -f \path\to\myscript.ps1 2>&1 > \path\to\log2.txt
 
When you're stuck, look for any installers or scripts which aren't really running in silent mode. There's really nothing special about Post-Setup (Before logon), it runs as SYSTEM (which has the same level of rights as Admin). But you're not allowed to interact by keyboard or mouse. Anything that has a pop-up dialog on install will hang, because you can't see the dialog or click to dismiss.

You can basically test your Post-Setup without performing an actual install. Open a CMD shell as Admin, run each of the Post-Setup commands by hand. If they complete without any user interaction, then it would have finished Post-Setup without problems.

If you have a batch or PS script, you can change the command to log the error output:

CommandParameters
cmd/c \path\to\myscript.bat 2>&1 > \path\to\log.txt
powershell-nop -ep bypass -f \path\to\myscript.ps1 2>&1 > \path\to\log2.txt
I've been testing the scripts as I go, and using powershell to invoke CMD files containing the basic commands to run the install silently and send to a log(msiexec /i (installer.msi) /q /l c:\mylogfile.txt). Each of them has their own log.

One does invoke a passive pop up, a short display of a progress bar requiring no interaction. Would that do it?
 
Depends whether you have to dismiss it. Switching to /qn instead of /qb might be the difference.
 
You can also switch all the post-setup items to the After Login mode, then it will have progress and all visibly presented to see which one gets stuck.
 
Well, progress!

garlin In your post you showed a way of invoking the powershell scripts in a way that was different than what I was doing. I was adding each individual script as a file.ps1 to be run in the pre or post, rather than as a command. I switched to what you had in your response:

powershell-nop -ep bypass -f \path\to\myscript.ps1 2>&1 > \path\to\log2.txt

Which got me further - it booted. I am able to troubleshoot the scripts on the image, and found one of the CMD files modified a default user registry setting that contained { } brackets. Because Powershell called it, I needed to add quotes around that key.

thanks! I'll keep pushing onward.
 
nuhi, can we just add a new option for SetupComplete logging?

Have an optional checkbox, so every script runs under:
Code:
call myscript.bat 2>&1 >> C:\Windows\Setup\SetupComplete.log
powershell -NoProfile -ExecutionPolicy Bypass -f myscript.ps1 2>&1 >> C:\Windows\Setup\SetupComplete.log
 
Well, progress!

garlin In your post you showed a way of invoking the powershell scripts in a way that was different than what I was doing. I was adding each individual script as a file.ps1 to be run in the pre or post, rather than as a command. I switched to what you had in your response:


powershell-nop -ep bypass -f \path\to\myscript.ps1 2>&1 > \path\to\log2.txt

Which got me further - it booted. I am able to troubleshoot the scripts on the image, and found one of the CMD files modified a default user registry setting that contained { } brackets. Because Powershell called it, I needed to add quotes around that key.

thanks! I'll keep pushing onward.
Scripts need to be added as files with Run mode. If you add a command it does nothing, of course it won't hang as it just skips.
NTLite will copy the file and enter the command if you add it as a file + Run and nothing else.

If it works manually, and is not reliant on a User, then send it to me for testing.
If it's reliant on the User, then move it to After login.
 
nuhi, can we just add a new option for SetupComplete logging?

Have an optional checkbox, so every script runs under:
Code:
call myscript.bat 2>&1 >> C:\Windows\Setup\SetupComplete.log
powershell -NoProfile -ExecutionPolicy Bypass -f myscript.ps1 2>&1 >> C:\Windows\Setup\SetupComplete.log
You can easily do that as is.
Add the PS1 file to the Post-setup page, then in the Parameters add what you need after the filename
in this case
Code:
2>&1 >> C:\Windows\Setup\SetupComplete.log
NTLite will generate that as:
powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Files\filename.ps1" 2>&1 >> C:\Windows\Setup\SetupComplete.log
 
I meant for NTLite to automatically do that as an optional debug feature. Most users aren't coders, they find scripts online and apply them. And adding a collection of individual scripts makes it tedious to copy/paste "2>&1 >> C:\Windows\Setup\SetupComplete.log".
 
I meant for NTLite to automatically do that as an optional debug feature. Most users aren't coders, they find scripts online and apply them. And adding a collection of individual scripts makes it tedious to copy/paste "2>&1 >> C:\Windows\Setup\SetupComplete.log".
Right. Would ease the debugging, adding it to the potential list, thanks.
 
I meant for NTLite to automatically do that as an optional debug feature. Most users aren't coders, they find scripts online and apply them. And adding a collection of individual scripts makes it tedious to copy/paste "2>&1 >> C:\Windows\Setup\SetupComplete.log".
Well, I'm not the greatest scripter, but this was my own collection of simple scripts. I had split them into two - a before set and an after set. I was about to tear my hair out over the apparent refusal for half the applications to load.

I believe the whole thing would grind to a halt if one of the child scripts choked. I'd used a -wait on my invoke command, because I didn't' think it would go well having the lot of them trying to install all at the same time. Once I found the wrong one, it was like unclogging a drain. It was the first time I've tried calling .CMD batch files from a .PS1 script.

Thanks for your help!
 
With PS, you have be careful about asynchronous (non-blocking) external commands:
& cmd
Start-Process cmd [without the -Wait]​

What's not uncommon is getting trapped in a race condition where a child process gets off to a slow start, and gets clobbered by timing issues. Here's a typical example which works fine in CMD (because it's blocking, but fails when not using Start-Process -Wait):

reg load HKU\TEMP NTUSER.DAT
reg add HKU\TEMP ... <-- "reg add" executes faster before "reg load" is done
reg unload HKU\TEMP
 
With PS, you have be careful about asynchronous (non-blocking) external commands:
& cmd
Start-Process cmd [without the -Wait]​

What's not uncommon is getting trapped in a race condition where a child process gets off to a slow start, and gets clobbered by timing issues. Here's a typical example which works fine in CMD (because it's blocking, but fails when not using Start-Process -Wait):

reg load HKU\TEMP NTUSER.DAT
reg add HKU\TEMP ... <-- "reg add" executes faster before "reg load" is done
reg unload HKU\TEMP
Oh! So, in that case, are you basically loading the hive, and unloading it before the change actually happens? My calling PS sucked up all the batch files in that location, and after executing each one, I forced it to -wait. I did not do that for the individual commands within the batch files.

So for your example, I loaded my default hive, made maybe 10 or so modifications to it, and unloaded. To be honest, my biggest fear was that the registry wouldn't release the hive with the unload, and hang that way, but the log showed all of them at least said that they were successful. But I had another batch script to install a program, throw some configurations at it, then run it, and that was one of the ones choking.
 
There's an old programming wisdom in regards to applying reg changes outside of reg/regedit commands, which is you have to wait a bit for PS or C++ routines to commit changes, before unmounting the hive. This is typically done by calling the GC (Garbage Collection) function.

GC cleanup has nothing to do with forcing the update. It's just a programmatic delay, not unlike sleeping for [N] milliseconds, to make sure the registry has committed the update. You have to remember, you're not the only consumer of the registry. Windows is busily making its own flood of changes, and the registry is never completely idle.

Run a registry changes tool for a few seconds, and you can see that.

When making the same changes thru reg.exe, it's more mindful of pending updates, before it allows another reg.exe process to unmount a hive.
 
Thank you - I will drop a bit of sleep time into the batch file going forward. You've been very helpful, thank you.
 
Back
Top