Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 10, 2000

How do I perform an operation on every machine running on the network?

RSS
Subscribe to Windows IT Pro | See More Systems Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

A. Normally, you can use a logon script. However, if you want to run a command or copy a file to every machine, you can use the following command.

net view > list.txt

This command outputs a list of current machines to the file list.txt. You can then parse that file to perform an operation (e.g., to copy files).

FOR /F " tokens=1 " %i in (list.txt) do copy quaropts.dat "%i\C$\program files\navnt"

If you placed this command in a file, you would need to use two percentage signs (i.e., %%), as follows.

FOR /F " tokens=1 " %%i in (list.txt) do copy quaropts.dat "%%i\C$\program files\navnt"

You could change the for command as follows to avoid using a temporary file.

FOR /F " tokens=1 " %i in ('net view') do copy quaropts.dat "%i\C$\program files\navnt"

End of Article



Reader Comments
I have tried to get away from dumping text files and parsing them when I can - so another way to do this..

FOR /F "tokens=1,2 delims=\ " %%A in ('browstat vw 1 \\ServerX') do (CALL :STEP1 %%A)

This tokens statement strips out the leading back slashes - The reason I sometime strip them out is because some tools don't use the slashes and it's easier to strip them and if need be add them back if you need both in a shell script.

You could use "net view" as well - but I tend to use browstat against a DC in an NT4 environment where browsing is working well -

Joel Krall April 17, 2003


Hi, i have a question regarding the Batch File, if i have My Domain - internal- with domain name ( Tantawi-group.com ) and have 20 Users On that domain, how can i make one patch file for all of them in one shoot to run Norton antiviruses ? when they log in by using batch file ? can you Please help me by using it on my e-mail which is tantawi82@hotmail.com ,

regards,
Mohammed Tantawi

Mohammed Tantawi November 03, 2003


Looks like some pretty good stuff. Where to pick up on more syntax and commands similar to those posted here.

Rob Wurster May 19, 2004


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
No Jobs, No Excitement at Apple's Last Macworld Keynote

Apple CEO Steve Jobs made the right move in skipping out on his company's last appearance at Macworld: In a Tuesday keynote address at the conference, Apple had no interesting new products to sell, opting instead to spend mind-numbing amounts of time on ...

Where is Microsoft NetMeeting in Windows XP?

...

The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Cloud Computing Forum: Integrating Software, Server and Storage as a Service into Your Enterprise IT Delivery Model

Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing