Solved

How To Run a BAT File...

Posted on 2014-01-08
6
509 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 69

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 69

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Automate Windows Updates with SCCM 2 88
Google photos - how to do a download dump? 15 80
GPO reset 2 45
Windows 10 ISO build version 3 50
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no backā€¦
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

733 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