Maybe this is s newb question, but here it is: How do I script a batch file that will cycle through a list of all my computers on the domain, run gpupdate /force, then on each computer log off all users? Here is what I have so far but it doesn't work:
for /f %%i in (servers.txt) do (
Psexec.exe \\%%i gpupdate.exe /Target:User /force
Psexec.exe \\%%i cmd for /f %%a in (1,1,3) do logoff %%a /server:localhost
)
I'm running into a problem by trying to add the "for" loop AFTER the Psexec part. It works if I do it before, but it is very slow because it tries to run psexec and connect every time.
By the way, I may be doing this the hard way, but I'm just trying to map a new drive to everyone's computer through GPO and have it be there in the morning when they get there without having to walk to each computer (even for logging off users so it applies). If you have a better way for that, I would really appreciate the help. Thanks!
Flaviu