Solved

How To Run a BAT File...

Posted on 2014-01-08
6
510 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 29

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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
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…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

689 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