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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delaying a "Run these programs at User logon"

Status
Not open for further replies.

KRPGroup

MIS
Jun 22, 2005
317
CA
I have a GPO that starts a program at logon but it is a bit CPU intensive along with all the other things running at logon. I would like to delay the startup of this program by 60-120 sec to improve logon time.
 
How are you running the program via a script? If it's an exe that you run you could use a vb script with a wait loop.
 
It is an exe that is launched with a GPO

Computer Configuration/Administrative Templates/System/Logon/Run these programs at user logon

It doesn't have any settings for delay there. I was considering to have a script do it but I would need some examples on how to do it as I don't know VBscript.
 
Ok you need to attach this to the user logon scripts area of your OU and give it a try. You will need to alter the share path, exe name and the amount of time to wait 1000 milliseconds = 1 second.
Past the code into notepad and save the file with a .vbs extension then put it with your logon scripts either in NETLOGON or in the GPO logon scripts folder.

Post back if you have any problems.

Code:
On Error Resume Next

Dim WSHShell,


Set WSHShell = CreateObject("WScript.Shell")



'wait 1000 milliseconds
wscript.sleep 1000


Set MyObj=CreateObject("WScript.Shell")
MyObj.Run "\\server\share\program.exe"


set WSHSHell = Nothing


'Quit the Script
wscript.quit
 
I have taken your script and saved it as you explained, then I tried to run it manually on my workstation by double clicking it.

I rec'd an error on line 4, 14 so I removed the comma and then it ran with no error but nothing is happening.

I edited the MyObj to point to the program I want to launch. It is installed on all our workstations locally.

"C:\Program Files\doc-it\Doc-ItStart.exe"

I then remmed out the sleep cmd and still nothing, how do I test to see what is happening.?
 
Code:
On Error Resume Next

Dim WSHShell

Set WSHShell = CreateObject("WScript.Shell")

'wait 1000 milliseconds
wscript.sleep 1000

Set MyObj=CreateObject("WScript.Shell")
MyObj.Run "C:\Progra~1\Doc-it\Doc-ItStart.exe"

set WSHSHell = Nothing

'Quit the Script
wscript.quit
 
Thanks that works now...

Is there any dif when putting the file in the Netlogon or the GPO folder..???
If I want to put it in the GPO folder, where is that.??
 
Putting the script in with the GPO just hides if from being easily read by nosey users.

The GPO's are located in the \\server\sysvol share each policy has a long HEX name be sure not to alter that, within that folder there is a user and machine folder holding the policy files. If the contents of the script isn't sensative then the NETLOGON folder is fine.

\\servername\SYSVOL\domainname\Policies\{D3BA9E43-92B8-4890-87EE-S142GDKDF}\User\Scripts\Logon
 
Oh if you right click on a GPO in active directory and select properties it will tell you the HEX name of the policy.
 
I tested the vbs by double clicking it and it ran exactly as I wanted 90sec.

When I created a GPO for it is right after logging in it pausing at the Running Scripts.. for 90 secs then logs on to the desktop.
Removing the GPO allows the computer to logon within sec's.
 
Hmm thats odd i use this to run an exe in my logon script and it just runs in the background after logon.

Is the script set in the user scripts area of the users OU?


 
No... I did it in Computer OU.. Looking back at your notes I see you said Users

Is that the issue.??
 
That was the problem... it paused properly now..

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top