Need a Basic Batch file script for Health Check on Servers -
i looking simple batch file can give me below details list of servers. there single domain.
- hostname
- ip address
- domain
- disk detailous
- cpu information
- physical memory
- os details
- type of server
i have made 1 myself, not seem run list of servers, runs many times single server. please me, below code:
for /f %%x in (computers.txt) systeminfo | findstr /c:"host name" >> c:\temp\output.txt /f %%x in (computers.txt) wmic cpu name >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"domain" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"os name" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"os version" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"system manufacturer" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"system model" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"system type" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"total physical memory" >> c:\temp\output.txt /f %%x in (computers.txt) ipconfig | findstr ipv4 >> c:\temp\output.txt /f %%x in (computers.txt) wmic diskdrive size >> c:\temp\output.txt /f %%x in (computers.txt) dsquery computer -name %%x >> c:\temp\output.txt
if assume got list of server name in computers.txt
.
- where server name passed system info command ?
- for loop used in code iterates line in
computers.txt
, provides output of system info of machine being executed every iteration not intended.
3.this process continues till lines iterated in computers.txt
.
- use below options fetch system info server using command in code as
systeminfo /s /u <<username>> /p <<password %%x use system info /? more details
%%x - contain information of file , changes each iteration ,it contain corresponding line value in file.
Comments
Post a Comment