Need some help creating some scripts (PSTOOLS)


Recommended Posts

Okay the time has come for me to really master pstools, Id like to use a gui program like fepstools or speccopssoftware but pstools is quicker in most cases then loading these programs and dealing with the little bugs.

My first script I would like to use psexec.exe to force all computers on the domain to run gpupdate /force

The next script I would like to write would pstools psshutdown to tell all machines to perform a forced reboot

The last thing using the scheduler in 2k3 to run psshutdown and force remote reboots every saturday night on the machines.

I appreciate the help in advanced

Edited by Prophecy
Link to comment
Share on other sites

Each of those are simple one-liners with the PsTools.

1. psexec -accepteula \\* gpupdate /force

2. psexec -accepteula -c \\* psshutdown -accepteula -r -f -t 0

3. Make a scheduled task with the command immediately above, scheduled for whenever you like :)

Make sure to run the commands from an account with Domain Admin privileges, as shutting down systems requires local "Administrators" group membership, and by default only members of Domain Admins are part of said group. Also, you can thank Microsoft for all those "-accepteula" switches, too. ;)

Link to comment
Share on other sites

To update group policies settings on the the machines then rather then waiting for the scheduled time.

Working on this one now

psexec -accepteula \\* gpupdate /force but i modified mine with a txt file so its

pseexec -accepteulla @computers.txt gpupdate /force

psexec -accepteula -c @computers.txt -accepteula -r -f -t 0 -v "Systems are currently being restarted" (This good as well?)

Link to comment
Share on other sites

To update group policies settings on the the machines then rather then waiting for the scheduled time.

I'll rephrase; what policy do you hope to refresh that doesn't require a relogin (user) or a restart (computer)?

Link to comment
Share on other sites

  • 2 weeks later...
http://www.windowsecurity.com/articles/How...Processing.html

Does that help?

Why script something that you need to happen NOW, as opposed to later? Wouldn't you just run what you want so that it affects the remote machines?

I say scripts in the wrong tense. I just wanted to get my syntax correct more then anything. I like the specopssoftware from that article it just worries me abit, ive used it before and it gets high reviews however always worries me to install that kind of software on servers. Anyways I appreciate it.

Thanks

Prophecy

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.