Guest User

Untitled

a guest
Nov 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. :: -----------------------------------------------------------------------------------
  2. :: Get System Information of Multiple Hosts
  3. :: -----------------------------------------------------------------------------------
  4. ::
  5. :: Scans one or many hosts via wmi queries.
  6. :: Currenty supported datasets:
  7. :: wmic os get /all
  8. :: wmic qfe get /all
  9. :: wmic logicaldisk get caption,description,filessystem,size,freespace,compressed
  10. :: wmic process list brief
  11. :: wmic bios list full
  12. :: -----------------------------------------------------------------------------------
  13.  
  14.  
  15. @echo off
  16. setlocal
  17. set desktop=%userprofile%\desktop
  18. set working=%desktop%\rhosts
  19. set filesdir=%working%\files
  20. ::set %host%=%1
  21.  
  22.  
  23. :: Create Working Directories
  24. mkdir %working%
  25. mkdir %filesdir%
  26.  
  27.  
  28. :: Create Document Header
  29. echo ^<HTML^>^<HEAD^>^<TITLE^>rhosts-info^</TITLE^>^</HEAD^> >> %working%\index.html
  30. echo ^<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="3b6689" VLINK="3b6689"^> >> %working%\index.html
  31. echo ^<h1 align="center"^>^<b^>^<font face="serif" size="+4" color=""^>WMIC System Information^</font^>^</b^>^</h1^> >> %working%\index.html
  32. echo ^<p align="center"^>^<table border="1" width="auto" color="666666"^> >> %working%\index.html
  33.  
  34.  
  35. :: Define Page Table Header
  36. echo ^<tr^>^<td^>^<B^>PC Name^</td^> >> %working%\index.html
  37. echo ^<td^>^<B^>OS Information^</td^> >> %working%\index.html
  38. echo ^<td^>^<B^>Installed KB Packages^</td^> >> %working%\index.html
  39. echo ^<td^>^<B^>Disk Information^</td^> >> %working%\index.html
  40. echo ^<td^>^<B^>Running Applications^</td^> >> %working%\index.html
  41. echo ^<td^>^<B^>BIOS Information^</td^>^</B^>^</tr^>^</p^> >> %working%\index.html
  42.  
  43.  
  44. :: Does rhosts.txt exist?
  45. if not exist rhosts.txt (
  46. goto :SINGLE
  47. ) else (
  48. goto :MULTIPLE
  49. )
  50.  
  51.  
  52. :MULTIPLE
  53. :: Main Loop (rhosts.txt)
  54. echo The rhosts.txt file exists!
  55. for /F "tokens=*" %%i in (rhosts.txt) do (
  56. echo Getting information on host: %%i
  57. wmic /node:"%%i" /output:"%filesdir%\%%i_OS.html" os get /all /format:hform
  58. wmic /node:"%%i" /output:"%filesdir%\%%i_qfe.html" qfe get /all /format:htable
  59. wmic /node:"%%i" /output:"%filesdir%\%%i_drives.html" logicaldisk get caption, description, filesystem, size, freespace, compressed /format:htable
  60. wmic /node:"%%i" /output:"%filesdir%\%%i_procs.html" process list brief /format:htable
  61. wmic /node:"%%i" /output:"%filesdir%\%%i_bios.html" bios list full /format:htable
  62. echo ^<tr^>^
  63. echo ^<td^>^<b^>%%i^</b^>^</td^> >> %working%\index.html
  64. echo ^<td^>^<a href="file://%filesdir%/%%i_os.html"^>Software Information^</a^>^</td^> >> %working%\index.html
  65. echo ^<td^>^<a href="file://%filesdir%/%%i_qfe.html"^>Windows Updates^</a^>^</td^> >> %working%\index.html
  66. echo ^<td^>^<a href="file://%filesdir%/%%i_drives.html"^>Drive Volumes^</a^>^</td^> >> %working%\index.html
  67. echo ^<td^>^<a href="file://%filesdir%/%%i_procs.html"^>Process List^</a^>^</td^> >> %working%\index.html
  68. echo ^<td^>^<a href="file://%filesdir%/%%i_bios.html"^>BIOS Detail^</a^>^</td^> >> %working%\index.html
  69. echo ^</tr^> >> %working%\index.html
  70. )
  71. goto :DONE
  72.  
  73.  
  74. :SINGLE
  75. set /p host=Please enter a host to scan:
  76. echo Getting information on host: %host%
  77. wmic /node:"%host%" /output:"%filesdir%\%host%_OS.html" os get /all /format:hform
  78. wmic /node:"%host%" /output:"%filesdir%\%host%_qfe.html" qfe get /all /format:htable
  79. wmic /node:"%host%" /output:"%filesdir%\%host%_drives.html" logicaldisk get caption, description, filesystem, size, freespace, compressed /format:htable
  80. wmic /node:"%host%" /output:"%filesdir%\%host%_procs.html" process list brief /format:htable
  81. wmic /node:"%host%" /output:"%filesdir%\%host%_bios.html" bios list full /format:htable
  82. echo ^<tr^>^
  83. echo ^<td^>^<b^>%host%^</b^>^</td^> >> %working%\index.html
  84. echo ^<td^>^<a href="file://%filesdir%/%host%_os.html"^>Software Information^</a^>^</td^> >> %working%\index.html
  85. echo ^<td^>^<a href="file://%filesdir%/%host%_qfe.html"^>Windows Updates^</a^>^</td^> >> %working%\index.html
  86. echo ^<td^>^<a href="file://%filesdir%/%host%_drives.html"^>Drive Volumes^</a^>^</td^> >> %working%\index.html
  87. echo ^<td^>^<a href="file://%filesdir%/%host%_procs.html"^>Process List^</a^>^</td^> >> %working%\index.html
  88. echo ^<td^>^<a href="file://%filesdir%/%host%_bios.html"^>BIOS Detail^</a^>^</td^> >> %working%\index.html
  89. echo ^</tr^> >> %working%\index.html
  90. goto :DONE
  91.  
  92.  
  93. :DONE
  94. echo ^<p align="center"^>^<b^>^<font size="+1" color="000"^>^<BR^>Completed: >> %working%\index.html
  95. time /T >> %working%\index.html
  96. echo - on >> %working%\index.html
  97. date /T >> %working%\index.html
  98. echo ^</font^>^</b^>^<BR^>^</p^> >> %working%\index.html
  99. goto :END
  100.  
  101.  
  102. :USAGE
  103. echo USAGE: rhosts
  104.  
  105. :END
  106. start iexplore.exe "file:///%userprofile%/Desktop/rhosts/index.html
  107. pause
Add Comment
Please, Sign In to add comment