Solved

How To Run a BAT File...

Posted on 2014-01-08
6
505 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
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 68

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 27

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 68

Accepted Solution

by:
Qlemo earned 250 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

Promote certifications in your email signature

Has your company recently won an award or achieved a certification? They'll no doubt want to show it off. Email signature images used to promote certifications & awards can instantly establish credibility with a recipient and provide you with numerous benefits.

Join & Write a Comment

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now