Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
9.2 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' System Information Status Page
  6. ' Copyright (c) Microsoft Corporation. All rights reserved.
  7. '-------------------------------------------------------------------------
  8. %>
  9. <!-- #include virtual="/admin/inc_framework.asp" -->
  10. <%
  11. '-------------------------------------------------------------------------
  12. ' Global Variables
  13. '-------------------------------------------------------------------------
  14. Dim rc
  15. Dim page
  16. Dim OSName
  17. Dim OSVersion
  18. Dim OSManufacturer
  19. Dim OSSerialNumber
  20. Dim SystemManufacturer
  21. Dim SystemModel
  22. Dim SystemType
  23. Dim SystemProcessor
  24. Dim SystemTotalMemory
  25. Dim SystemBIOS
  26. Dim SystemServiceTag
  27. Dim DiskSpace
  28. Dim NbDisks
  29. Dim SOURCE_FILE
  30. Const ENABLE_TRACING = TRUE
  31. SOURCE_FILE = SA_GetScriptFileName()
  32. '-------------------------------------------------------------------------
  33. ' Global Form Variables
  34. '-------------------------------------------------------------------------
  35. '-------------------------------------------------------------------------
  36. ' Local Variables
  37. '-------------------------------------------------------------------------
  38. Dim L_SIPAGE_TITLE
  39. Dim L_SIOS_NAME
  40. Dim L_SIOS_VERSION
  41. Dim L_SIOS_MFCT
  42. Dim L_SISYSTEM_MFCT
  43. Dim L_SISYSTEM_MODEL
  44. Dim L_SISYSTEM_TYPE
  45. Dim L_SISYSTEM_PROC
  46. Dim L_SISERVICE_TAG
  47. Dim L_SIBIOS_VER
  48. Dim L_SIPHYSICAL_MEMORY
  49. Dim L_SIDISK_SPACE
  50. Dim L_SIDISK_SPACE_VALUE
  51. Dim L_SIMB
  52. 'error messages
  53. Dim L_SIWMI_ERROR
  54. L_SIPAGE_TITLE =GetLocString("sysinfomsg.dll","4088000A", "")
  55. L_SIOS_NAME =GetLocString("sysinfomsg.dll","4088000B", "")
  56. L_SIOS_VERSION =GetLocString("sysinfomsg.dll","4088000C", "")
  57. L_SIOS_MFCT =GetLocString("sysinfomsg.dll","4088000D", "")
  58. L_SISYSTEM_MFCT =GetLocString("sysinfomsg.dll","4088000E", "")
  59. L_SISYSTEM_MODEL =GetLocString("sysinfomsg.dll","4088000F", "")
  60. L_SISYSTEM_TYPE =GetLocString("sysinfomsg.dll","40880010", "")
  61. L_SISYSTEM_PROC =GetLocString("sysinfomsg.dll","40880011", "")
  62. L_SISERVICE_TAG =GetLocString("sysinfomsg.dll","40880012", "")
  63. L_SIBIOS_VER =GetLocString("sysinfomsg.dll","40880013", "")
  64. L_SIPHYSICAL_MEMORY =GetLocString("sysinfomsg.dll","40880014", "")
  65. L_SIDISK_SPACE =GetLocString("sysinfomsg.dll","40880015", "")
  66. L_SIWMI_ERROR =GetLocString("sysinfomsg.dll","C0880018", "")
  67. '======================================================
  68. ' Entry point
  69. '======================================================
  70. '
  71. ' Create Page
  72. rc = SA_CreatePage( L_SIPAGE_TITLE, "", PT_AREA, page )
  73. '
  74. ' Show page
  75. rc = SA_ShowPage( page )
  76. Public Function OnClosePage(ByRef PageIn, ByRef Reserved)
  77. OnClosePage = TRUE
  78. End Function
  79. '======================================================
  80. ' Web Framework Event Handlers
  81. '======================================================
  82. '---------------------------------------------------------------------
  83. ' Function: OnInitPage
  84. '
  85. ' Synopsis: Called to signal first time processing for this page. Use this method
  86. ' to do first time initialization tasks.
  87. '
  88. ' Returns: TRUE to indicate initialization was successful. FALSE to indicate
  89. ' errors. Returning FALSE will cause the page to be abandoned.
  90. '
  91. '---------------------------------------------------------------------
  92. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  93. If ( ENABLE_TRACING ) Then
  94. Call SA_TraceOut(SOURCE_FILE, "OnInitPage")
  95. End If
  96. OnInitPage = GetSystemInfo()
  97. End Function
  98. '---------------------------------------------------------------------
  99. ' Function: OnServePageletPage
  100. '
  101. ' Synopsis: Called when the page needs to be served. Use this method to
  102. ' serve content.
  103. '
  104. ' Returns: TRUE to indicate no problems occured. FALSE to indicate errors.
  105. ' Returning FALSE will cause the page to be abandoned.
  106. '
  107. '---------------------------------------------------------------------
  108. Public Function OnServeAreaPage(ByRef PageIn, ByRef EventArg)
  109. If ( ENABLE_TRACING ) Then
  110. Call SA_TraceOut(SOURCE_FILE, "OnServePageletPage")
  111. End If
  112. %>
  113. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  114. </script>
  115. <script language="JavaScript">
  116. function Init()
  117. {
  118. }
  119. </script>
  120. <table border="0" cellpadding="0" cellspacing="0" id="AutoNumber1" class="TasksBody">
  121. <tr>
  122. <td nowrap class="TasksBody"><%=L_SIOS_NAME%></td>
  123. <td nowrap class="TasksBody"><i><%=OSName%></i></td>
  124. </tr>
  125. <tr>
  126. <td nowrap class="TasksBody"><%=L_SIOS_VERSION%></td>
  127. <td nowrap class="TasksBody"><i><%=OSVersion%></i></td>
  128. </tr>
  129. <tr>
  130. <td nowrap class="TasksBody"><%=L_SIOS_MFCT%></td>
  131. <td nowrap class="TasksBody"><i><%=OSManufacturer%></i></td>
  132. </tr>
  133. <tr>
  134. <td nowrap class="TasksBody"><%=L_SISYSTEM_MFCT%></td>
  135. <td nowrap class="TasksBody"><i><%=SystemManufacturer%></i></td>
  136. </tr>
  137. <tr>
  138. <td nowrap class="TasksBody"><%=L_SISYSTEM_MODEL%></td>
  139. <td nowrap class="TasksBody"><i><%=SystemModel%></i></td>
  140. </tr>
  141. <tr>
  142. <td nowrap class="TasksBody"><%=L_SISYSTEM_TYPE%></td>
  143. <td nowrap class="TasksBody"><i><%=SystemType%></i></td>
  144. </tr>
  145. <tr>
  146. <td nowrap class="TasksBody"><%=L_SISYSTEM_PROC%></td>
  147. <td nowrap class="TasksBody"><i><%=SystemProcessor%></i></td>
  148. </tr>
  149. <tr>
  150. <td nowrap class="TasksBody"><%=L_SISERVICE_TAG%></td>
  151. <td nowrap class="TasksBody"><i><%=SystemServiceTag%></i></td>
  152. </tr>
  153. <tr>
  154. <td nowrap class="TasksBody"><%=L_SIBIOS_VER%></td>
  155. <td nowrap class="TasksBody"><i><%=SystemBIOS%></i></td>
  156. </tr>
  157. <tr>
  158. <td nowrap class="TasksBody"><%=L_SIPHYSICAL_MEMORY%></td>
  159. <td nowrap class="TasksBody"><i><%=SystemTotalMemory%></i></td>
  160. </tr>
  161. <tr>
  162. <td nowrap class="TasksBody"><%=L_SIDISK_SPACE%></td>
  163. <td nowrap class="TasksBody"><i><%=DiskSpace%></i></td>
  164. </tr>
  165. </table>
  166. <%
  167. OnServeAreaPage = TRUE
  168. End Function
  169. '---------------------------------------------------------------------------
  170. '
  171. ' Function: GetSystemInfo
  172. '
  173. ' Synopsis:
  174. '
  175. ' Arguments: [out]
  176. '
  177. '---------------------------------------------------------------------------
  178. Function GetSystemInfo
  179. Err.clear
  180. On Error Resume Next
  181. Dim objService
  182. Dim objInstance
  183. Dim objCollection
  184. Dim arrStrings(1)
  185. Dim strParam
  186. Set objService = GetWMIConnection("")
  187. Set objCollection = objService.InstancesOf ("Win32_OperatingSystem")
  188. If Err.Number <> 0 Then
  189. Call SA_ServeFailurePageEx(L_SIWMI_ERROR & " ( " & Hex(Err.number) & " )", SA_DEFAULT)
  190. End If
  191. For each objInstance in objCollection
  192. OSName = objInstance.Caption
  193. OSVersion = objInstance.Version & " " & objInstance.CSDVersion & " build " & objInstance.BuildNumber
  194. OSManufacturer = objInstance.Manufacturer
  195. OSSerialNumber = objInstance.SerialNumber
  196. Next
  197. objInstance = nothing
  198. objCollection = nothing
  199. Set objCollection = objService.InstancesOf ("Win32_ComputerSystem")
  200. If Err.Number <> 0 Then
  201. Call SA_ServeFailurePage (L_SIWMI_ERROR & " ( " & Hex(Err.number) & " )", SA_DEFAULT)
  202. End If
  203. For each objInstance in objCollection
  204. SystemType= objInstance.SystemType
  205. SystemModel = objInstance.Model
  206. SystemManufacturer = objInstance.Manufacturer
  207. SystemTotalMemory = objInstance.TotalPhysicalmemory
  208. Next
  209. arrStrings(0) = CStr(Round(SystemTotalMemory/1024/1024,0))
  210. strParam = arrStrings
  211. SystemTotalMemory = GetLocString("sysinfomsg.dll","40880016", strParam)
  212. objInstance = nothing
  213. objCollection = nothing
  214. Set objCollection = objService.InstancesOf ("Win32_BIOS")
  215. If Err.Number <> 0 Then
  216. Call SA_ServeFailurePage (L_SIWMI_ERROR & " ( " & Hex(Err.number) & " )", SA_DEFAULT)
  217. End If
  218. For each objInstance in objCollection
  219. SystemBIOS= objInstance.Version
  220. Next
  221. objInstance = nothing
  222. objCollection = nothing
  223. Set objCollection = objService.InstancesOf ("Win32_SystemEnclosure")
  224. If Err.Number <> 0 Then
  225. Call SA_ServeFailurePage (L_SIWMI_ERROR & " ( " & Hex(Err.number) & " )", SA_DEFAULT)
  226. End If
  227. For each objInstance in objCollection
  228. SystemServiceTag= objInstance.SerialNumber
  229. Next
  230. objInstance = nothing
  231. objCollection = nothing
  232. Set objCollection = objService.InstancesOf ("Win32_processor")
  233. If Err.Number <> 0 Then
  234. Call SA_ServeFailurePage (L_SIWMI_ERROR & " ( " & Hex(Err.number) & " )", SA_DEFAULT)
  235. End If
  236. For each objInstance in objCollection
  237. SystemProcessor= objInstance.Description
  238. Next
  239. objInstance = nothing
  240. objCollection = nothing
  241. Set objCollection = objService.InstancesOf ("Win32_DiskDrive")
  242. If Err.Number <> 0 Then
  243. Call SA_ServeFailurePage (L_SIWMI_ERROR & " ( " & Hex(Err.number) & " )", SA_DEFAULT)
  244. End If
  245. DiskSpace = 0
  246. NbDisks = 0
  247. For each objInstance in objCollection
  248. DiskSpace = DiskSpace + objInstance.Size
  249. NbDisks = NbDisks + 1
  250. Next
  251. arrStrings(0) = CStr(Round(DiskSpace/1024/1024/1024,0))
  252. arrStrings(1) = CStr(NbDisks)
  253. strParam = arrStrings
  254. DiskSpace = GetLocString("sysinfomsg.dll","40880017", strParam)
  255. objInstance = nothing
  256. objCollection = nothing
  257. GetSystemInfo = TRUE
  258. End Function
  259. %>