Re: DOS .... Command Prompt ..... Batch Files



On Sat, 25 Jun 2005 20:58:01 -0400, <JoJo> wrote:

>Hello:
>
>
>
>The popular scripting languages are VBscript, ADSI, WMI,WSH, ETC. I am
>highly interested in the use of Scripting to (help) manage computer
>networks. Here is my question:
>
>
>
>* How useful is it to be able to write batch files and run them from the
>command prompt to help manage the typical network ? Is DOS-like scripting
>and batch files worth the
> required investment of time and effort ?
>
>* Take a simple command like CHKDSK.EXE or DEFRAG.EXE. How would you run
>these commands across a bunch of machines using (DOS) command prompt or
>batch files ?
>
>
>
>Thanks,
>Jo.
>
>
Sometimes the CMD processor is the best tool for a job.
Generally, a mix of tools is the correct choice.

To run a job remotely, use PsExec.exe, tip 4141 » PsExec freeware executes programs remotely.
in the 'Tips & Tricks' at http://www.jsifaq.com

To run defrag.exe on all Windows XP clients C: drive:

@echo off
setlocal
set qry=reg.exe query
for /f "Tokens=1" %%c in ('net view /domain:"%USERDOMAIN%"^|Findstr /L /C:"\\"') do (
for /f "Tokens=2*" %%r in ('%qry% "%%c\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion^|find "REG_SZ"') do (
if "%%s" EQU "5.1" @echo %%c&psexec %%c -u domadminaccount -p domadminpwd defrag C: -f
)
)
endlocal




.



Relevant Pages

  • DOS .... Command Prompt ..... Batch Files
    ... The popular scripting languages are VBscript, ADSI, WMI,WSH, ETC. ... networks. ... * How useful is it to be able to write batch files and run them from the ... command prompt to help manage the typical network? ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: scripting vs. batch files?
    ... >| I've been using batch files for ages, ... >| client was Windows 2000 or Windows XP. ... >| Can you incorporate scripting syntax in a batch file or should I stop using ...
    (microsoft.public.windows.server.scripting)
  • Re: Is vbscript appropriate tool?
    ... contrast of using vbscript versus batch files for tasks such as the ... actual scripting examples for just about all the basic functions. ...
    (microsoft.public.scripting.vbscript)
  • Re: SP2 installation internal error...
    ... >> well, the file icon doesn't look like the standard Command Prompt icon does, ... >> typical command prompt black background icon). ... >> any permissions set up in my multiple user accounts I can't find any. ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsupdate)
  • Re: How to change the working directory of application launched from a script?
    ... The problem is that I need to launch ... >ShellExecute method with a Working Directory parameter: ... >To close the command prompt after launch of myprog.exe, ... >torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.wsh)

Loading