?
Solved

How To Run a BAT File...

Posted on 2014-01-08
6
Medium Priority
?
514 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 70

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 70

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
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…
Suggested Courses

764 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