Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Users logon before STARTUP script finishes

Status
Not open for further replies.

DanMc

MIS
Sep 15, 2000
95
US
Is there any way to force the clients to completely finish processing of all logon scripts before the CTRL-ALT-DEL login prompt appears?

I have a complicated startup script that makes changes to the user profiles. (For example, one startup script deletes any profiles that contains over 5 mp3's.) If the user is fast, and logs in before the script finishes deleting the profile, we see really funny results. However, if the startup script is able to delete the profile, the next time the user logs on, he gets a fresh clean copy of the default profile.

I first tried a GPO to disable "Run startup scripts asynchronously". Unfortunately, this setting works exactly as expected... The startup scripts all run in a row, one at a time, BUT it is clear that the logon prompt doesn't have anything to do with the startup scripts. The logon prompt appears as soon as the workstation service starts.
 
If your users are not doing much else and you don't mind burning their cpu time, the simple solution is a semaphore file.

Delete the semaphore file before the script.

Run the script which creates the semaphore file as the last step.

Later on in the script put in a loop that waits for the semapohore file.

I don't have an 2K to test with, but something like the following steps should work.

pseudo code

CLEANUP Script
Code:
  if more than 5 mp3s do this... 
  . . .
  echo x>c:\semaphore.dat


In the login script do
Code:
  . . .
  delete c:\semaphore.dat
  CLEANUP
  . . .

Loopit:
  if not exist c:\semaphore.dat goto loopit

If you want to be nice to your users make a little process that yields time for a second and put it in the semaphore wait loop. That mitght be a good idea if the other scripts take a lot of CPU time.

heck. I think I'll make one.

J

-------------------------------------
Jnick opinions are not necessarily those of
Code:
Ronin Software Group
 
You sound like you've done this stuff before, too.

The problem I ran in to with a semaphore file is that you have no guarantee that the STARTUP script will run before the user logs on. The STARTUP scripts run as SYSTEM, and I need to take advantage of that security level to delete the profile. (The MP3 violation is just one example of the types of profile manipulation I want to do at STARTUP) I need some way to guarantee that the user is not logged on when I manipulate their profile at the file/directory level.

Even if the LOGON script is sitting in a loop, the user is already logged in, and their profile is open.

I want to force the logon prompt to wait for STARTUP scripts to complete. The logon prompt is displayed as soon as the associated services start. (I think workstation and netlogon are the main ones). As soon as these services start, the user can logon. On a fast PC, there is a good chance that the STARTUP scripts haven't even started running at this point.

I just had another idea, but it's pretty heavy-handed. If profile manipulation is required, I could create a semaphore, then spawn a shutdown (3rd party shutdown.exe). The SHUTDOWN script could detect the semaphore file, and perform the manipulation of the profile. I am pretty sure that the SHUTDOWN script is not launched till after the profile is closed.
 
You say.,..

"I want to force the logon prompt to wait for STARTUP scripts to complete. The logon prompt is displayed as soon as the associated services start."

That seems like a big 'Oops!' to me. I think I misundeerstood something about user authentication.

However it sounds like you are on to something.

Once you get control of the tasks talking to eachother and timing ... Good luck and let us know how it comes out.

**




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top