SS64 Discussion Forum

You are not logged in.

#1 2010-01-28 14:43:21

prakash82x
8086
Registered: 2009-03-03
Posts: 12

Extract info from remote system

Hi, I am trying to extract some info from remote machines usnig below script

for /f %%f IN (c:\host.txt) do echo Host Name = %%f >> c:\output.txt && systeminfo |find "OS Build Type" >> c:\output.txt

But the output.txt contains output from the Local machine and not from the remote however when run without sending output to the output.txt it gives the proper output but the same is not being written to the file.

Offline

#2 2010-01-28 16:53:49

Simon Sheppard
Super Administrator
Registered: 2005-08-27
Posts: 506
Website

Re: Extract info from remote system

you need to pass or pipe the host name into systeminfo /S

use a subroutine
for /f %%f IN (c:\host.txt) do (CALL :mysubroutine %%f )

...etc

http://ss64.com/nt/systeminfo.html

Offline

#3 2010-01-29 06:19:59

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-12-29
Posts: 702

Re: Extract info from remote system

As Simon intimated, you haven't told "systeminfo" to work against a remote system.  Maybe this (untested)?

for /f %%f IN (c:\host.txt) do systeminfo /s %%f | findstr "^Host.Name: ^OS.Build.Type:" >> c:\output.txt

Online

Board footer

Powered by FluxBB