Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How To Run a BAT File...

Posted on 2014-01-08
6
Medium Priority
?
520 Views
Last Modified: 2014-01-16
Hi.

I do have a BAT file deployed though GPO that collects certain system information when a user logs onto our domain.

Is there a way to issue a command that forces this file to run on all machine currently connected to the network?
0
Comment
Question by:IDMA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Expert Comment

by:Korbus
ID: 39765865
http://technet.microsoft.com/en-us/library/dd819505.aspx

Here is a sample from the article that runs a command on two servers:

invoke-command -computername Server01, Server02 -filepath c:\Scripts\DiskCollect.ps1

It looks like with this method your will need to specify each and every computer, rather than say "the whole network".
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 39765989
Korbus,

That requires PowerShell, and enabled and configured PS Remoting, and   - as you stated correctly -  requires to name all machines manually.


IDMA,

All methods I know require to first get a list of machines, and then issue a command to start the batch. The batch run could be forced by creating a non-persisting scheduled task, or with SysInternals PsExec, to name two common approaches.
0
 
LVL 30

Expert Comment

by:serialband
ID: 39767344
Here's a link to step-by-step instructions on how to do that.

http://www.petri.co.il/setting-up-logon-script-through-gpo-windows-server-2008.htm
0
 

Author Comment

by:IDMA
ID: 39772372
Qlemo,

I have the list on a text file and also have the whole Sysinternals suite installed.  I have been trying a few things without luck.

How would you write the command for PsExec?
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 1000 total points
ID: 39772788
There are a lot of options, but I think something along
psexec @c:\computers.txt -d -c c:\script.cmd  -n 5 -s

Open in new window

should work well. It doesn't wait for completion (-d), runs as System (-s), waits for no longer than 5 seconds to connect to each PC (-n 5), and copies the script into system32 for execution, so you won't have any issues with UNC paths (or need info where the GPO put the script to).
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A safe way to clean winsxs folder from your windows server 2008 R2 editions
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question