Re: DOS .... Command Prompt ..... Batch Files
- From: Jerold Schulman <Jerry@xxxxxxxxxx>
- Date: Sun, 26 Jun 2005 07:29:40 -0400
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
.
- References:
- DOS .... Command Prompt ..... Batch Files
- From: JoJo
- DOS .... Command Prompt ..... Batch Files
- Prev by Date: DOS .... Command Prompt ..... Batch Files
- Next by Date: Re: Closing open files \ sessions
- Previous by thread: DOS .... Command Prompt ..... Batch Files
- Next by thread: Re: DOS .... Command Prompt ..... Batch Files
- Index(es):
Relevant Pages
|
Loading