Search code examples
windowsbatch-filefilesysteminfo

Batch to get systeminfo for Multi remote windows servers


I'm trying to make a batch file to run the systeminfo command.

I am using this command for one server and it's working but I need for multiple servers.

SYSTEMINFO /S ServerName /U My_Domain\my_domain_account /p my_password >C:\Systeminfo.txt

I couldn't use powershell, we have windows server 2003, 2008 and 2008R2.

I need to check Registered Owner and Registered Organization but would be great to have output like above command.

Thank You in Advance


Solution

  • Put your list of servers in a text file, one server name per line. Then create a .cmd file that looks like this:

    @echo off
    setlocal enableextensions
    for /f %%s in ('type "serverlist.txt"') do call :PROCESS %%s
    goto :END
    
    :PROCESS
    systeminfo /s %1 > %1.txt
    goto :EOF
    
    :END
    endlocal
    

    When you run this script you will have .txt files with system info for each server.