ps1 script not working in Post-Setup

Pcgamer27

Member
Messages
170
Reaction score
1
change background and locking screen with ps1 before logon

but it won't run during the pre-logon phase
 
Last edited:
There's two methods for changing the lock screen backgrounds. The "correct" way changes the settings for each user's account profile and leaves the system defaults alone. The "wrong" way overwrites the shared default background, so every user inherits the same image.

Depending on which method, a customization script may not work in (Before logon) versus (After logon).

(Before logon) runs under the SYSTEM identity, and not as your user account. HKEY_CURRENT_USER doesn't point to you.
(After logon) runs after you've logged on to the desktop. HKEY_CURRENT_USER is you.

If you have to update HKCU, then a script must run during (After logon).
 
There's two methods for changing the lock screen backgrounds. The "correct" way changes the settings for each user's account profile and leaves the system defaults alone. The "wrong" way overwrites the shared default background, so every user inherits the same image.

Depending on which method, a customization script may not work in (Before logon) versus (After logon).

(Before logon) runs under the SYSTEM identity, and not as your user account. HKEY_CURRENT_USER doesn't point to you.
(After logon) runs after you've logged on to the desktop. HKEY_CURRENT_USER is you.

If you have to update HKCU, then a script must run during (After logon).

Do parameters sometimes need to be added when running a ps1 or cmd script?
 
It depends on the script. Some scripts are designed to run with no command-line options. Other scripts will require them.

Any app or script which runs during (Before logon) cannot expect to get user input, like a mouse click or keyboard input.

The reason is Windows hides any running processes behind a "splash screen" that is automatically on top. If your script wants to read the keyboard, it will be stuck since the user can't see the hidden command window running behind the screen. So your script is stuck, and blocks Post-Setup from finishing.
 
Back
Top