# Logon Script Response



## newhouse1390 (Jan 10, 2005)

I am trying to run GP update as a logon script (batch file). When the command executes it leaves an open end, asking for user input. How can the script say yes or no to the command. When the script runs "as is" (below) the computer seems to freeze until the script times out.




C:\Documents and Settings\JPGR\Desktop\Logon Scripts>gpupdate /force
Refreshing Policy...

User Policy Refresh has completed.
Computer Policy Refresh has completed.

To check for errors in policy processing, review the event log.

Certain User policies are enabled that can only run during logon.

OK to logoff?. (Y/N)


----------



## crazijoe (Oct 19, 2004)

Actually when you log into the domain the domain GP will take presence. You should not have to force the GP onto the user.


----------



## newhouse1390 (Jan 10, 2005)

I have some wireless clients that logon. When they login the policies need to be refreshed because another user logging into that computer needs to have the most up to date policy from the root of the domain to allow proper login. 

Some of the wireless clients are logging in on cached credentials so if they change their password on one computer I need the policy on the other computer to be up to date (after the already logged in user has logged out (logoff script forcing the GP update)). This will allow the user to login with their "new password".

I am going for a logoff script to refresh the computers policy.


----------



## crazijoe (Oct 19, 2004)

I do see where you are going with this because every once in a while we will have users, that are allready logged into their computers, open outlook. Well if it was time for them to change their password, Windows will ask them to enter username, password and domain name to open outlook. All we do is tell the user to log off their computer and log back in and it will prompt them to change their password.

gpupdate /force will update all policies

You could also use

gpupdate /target:machine to refresh the machine (or computer) policies or
gpupdate /target:user to refresh the user policies

Normally, policies will refresh every 90 min with a +/- 30 min interval (60, 90, or 120min), as long as the user is logged into the domain. Also every PC will requset all group policies to be reapplied every 16 hours.


----------



## newhouse1390 (Jan 10, 2005)

When the logon script completes is asks "OK to Logoff? Y/N?" How can I answer yes or no using the script? The problem is when the script is executed it hangs and it can take up to 5 min for the script to I guess time out. How can I speed this process up. 

Here is my script:


gpupdate /force

Refreshing Policy...

User Policy Refresh has completed.
Computer Policy Refresh has completed.

To check for errors in policy processing, review the event log.

Certain User policies are enabled that can only run during logon.

OK to logoff?. (Y/N)


----------

