Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: -----------------------------------------------------------------------------------
- :: Get System Information of Multiple Hosts
- :: -----------------------------------------------------------------------------------
- ::
- :: Scans one or many hosts via wmi queries.
- :: Currenty supported datasets:
- :: wmic os get /all
- :: wmic qfe get /all
- :: wmic logicaldisk get caption,description,filessystem,size,freespace,compressed
- :: wmic process list brief
- :: wmic bios list full
- :: -----------------------------------------------------------------------------------
- @echo off
- setlocal
- set desktop=%userprofile%\desktop
- set working=%desktop%\rhosts
- set filesdir=%working%\files
- ::set %host%=%1
- :: Create Working Directories
- mkdir %working%
- mkdir %filesdir%
- :: Create Document Header
- echo ^<HTML^>^<HEAD^>^<TITLE^>rhosts-info^</TITLE^>^</HEAD^> >> %working%\index.html
- echo ^<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="3b6689" VLINK="3b6689"^> >> %working%\index.html
- echo ^<h1 align="center"^>^<b^>^<font face="serif" size="+4" color=""^>WMIC System Information^</font^>^</b^>^</h1^> >> %working%\index.html
- echo ^<p align="center"^>^<table border="1" width="auto" color="666666"^> >> %working%\index.html
- :: Define Page Table Header
- echo ^<tr^>^<td^>^<B^>PC Name^</td^> >> %working%\index.html
- echo ^<td^>^<B^>OS Information^</td^> >> %working%\index.html
- echo ^<td^>^<B^>Installed KB Packages^</td^> >> %working%\index.html
- echo ^<td^>^<B^>Disk Information^</td^> >> %working%\index.html
- echo ^<td^>^<B^>Running Applications^</td^> >> %working%\index.html
- echo ^<td^>^<B^>BIOS Information^</td^>^</B^>^</tr^>^</p^> >> %working%\index.html
- :: Does rhosts.txt exist?
- if not exist rhosts.txt (
- goto :SINGLE
- ) else (
- goto :MULTIPLE
- )
- :MULTIPLE
- :: Main Loop (rhosts.txt)
- echo The rhosts.txt file exists!
- for /F "tokens=*" %%i in (rhosts.txt) do (
- echo Getting information on host: %%i
- wmic /node:"%%i" /output:"%filesdir%\%%i_OS.html" os get /all /format:hform
- wmic /node:"%%i" /output:"%filesdir%\%%i_qfe.html" qfe get /all /format:htable
- wmic /node:"%%i" /output:"%filesdir%\%%i_drives.html" logicaldisk get caption, description, filesystem, size, freespace, compressed /format:htable
- wmic /node:"%%i" /output:"%filesdir%\%%i_procs.html" process list brief /format:htable
- wmic /node:"%%i" /output:"%filesdir%\%%i_bios.html" bios list full /format:htable
- echo ^<tr^>^
- echo ^<td^>^<b^>%%i^</b^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%%i_os.html"^>Software Information^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%%i_qfe.html"^>Windows Updates^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%%i_drives.html"^>Drive Volumes^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%%i_procs.html"^>Process List^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%%i_bios.html"^>BIOS Detail^</a^>^</td^> >> %working%\index.html
- echo ^</tr^> >> %working%\index.html
- )
- goto :DONE
- :SINGLE
- set /p host=Please enter a host to scan:
- echo Getting information on host: %host%
- wmic /node:"%host%" /output:"%filesdir%\%host%_OS.html" os get /all /format:hform
- wmic /node:"%host%" /output:"%filesdir%\%host%_qfe.html" qfe get /all /format:htable
- wmic /node:"%host%" /output:"%filesdir%\%host%_drives.html" logicaldisk get caption, description, filesystem, size, freespace, compressed /format:htable
- wmic /node:"%host%" /output:"%filesdir%\%host%_procs.html" process list brief /format:htable
- wmic /node:"%host%" /output:"%filesdir%\%host%_bios.html" bios list full /format:htable
- echo ^<tr^>^
- echo ^<td^>^<b^>%host%^</b^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%host%_os.html"^>Software Information^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%host%_qfe.html"^>Windows Updates^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%host%_drives.html"^>Drive Volumes^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%host%_procs.html"^>Process List^</a^>^</td^> >> %working%\index.html
- echo ^<td^>^<a href="file://%filesdir%/%host%_bios.html"^>BIOS Detail^</a^>^</td^> >> %working%\index.html
- echo ^</tr^> >> %working%\index.html
- goto :DONE
- :DONE
- echo ^<p align="center"^>^<b^>^<font size="+1" color="000"^>^<BR^>Completed: >> %working%\index.html
- time /T >> %working%\index.html
- echo - on >> %working%\index.html
- date /T >> %working%\index.html
- echo ^</font^>^</b^>^<BR^>^</p^> >> %working%\index.html
- goto :END
- :USAGE
- echo USAGE: rhosts
- :END
- start iexplore.exe "file:///%userprofile%/Desktop/rhosts/index.html
- pause
Add Comment
Please, Sign In to add comment