Guest User

CIT + Serial

a guest
Sep 20th, 2011
419
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub GetSerial(BYRef strSerial)
  2.     Dim objItem, colItems
  3.     Set colItems = objWMI.ExecQuery("Select IdentifyingNumber from Win32_ComputerSystemProduct")
  4.     For Each objItem In colItems
  5.         On Error Resume Next
  6.         strSerial = HTMLEncode(objItem.IdentifyingNumber)
  7.     Next
  8. End Sub
  9.  
  10. ' ***************************************
  11. ' Returns a HTML report for the "Operating System/General" section
  12. ' ***************************************  
  13. Function OS_HTML()
  14.  
  15.     Dim objItem, colItems
  16.     Dim strHTML
  17.     Dim strSerial
  18.     Dim strDNSHostName,strDomain,strDomainRole,strManufacturer,strModel,strUserName
  19.     GetSerial strSerial
  20.     GetComputerSystemInfo strDNSHostName,strDomain,strDomainRole,strManufacturer,strModel,strUserName
  21.    
  22.     Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem")
  23.    
  24.     strHTML = "<h3>Current User: " & strUserName & "</h3>"
  25.    
  26.     For Each objItem In colItems
  27.         Dim strComputerRole
  28.         Dim strCaption,strBuildNumber,strInstallDate,strBootDate
  29.         Dim intServicePackMajor,intServicePackMinor,intTotalVisibleMemorySize
  30.         Dim intFreePhysicalMemory,intTotalVirtualMemorySize,intFreeVirtualMemory
  31.         On Error Resume Next
  32.         strCaption = HTMLEncode(objItem.Caption)
  33.         strBuildNumber = HTMLEncode(objItem.BuildNumber)
  34.         intServicePackMajor = objItem.ServicePackMajorVersion
  35.         intServicePackMinor = objItem.ServicePackMinorVersion
  36.         intTotalVisibleMemorySize = objItem.TotalVisibleMemorySize
  37.         intFreePhysicalMemory = objItem.FreePhysicalMemory
  38.         intFreeVirtualMemory = objItem.FreeVirtualMemory
  39.         intTotalVirtualMemorySize = objItem.TotalVirtualMemorySize
  40.         strInstallDate = FormatDate(objItem.InstallDate)
  41.         strBootDate = FormatDate(objItem.LastBootUpTime)
  42.         On Error Goto 0
  43.         'Const GroupDigits = "-1"
  44.                
  45.         strHTML = strHTML & "<table class=""Table"">" & _
  46.                     "<tr>" & _
  47.                     "<th>Operating System:</th><td>" & strCaption & "</td>" & _
  48.                     "<th>Service Pack:</th><td>" & intServicePackMajor & "." &  intServicePackMinor & "</td>" & _
  49.                     "</tr><tr>" & _
  50.                     "<th>Serial Number:</th><td>" & strSerial & "</td>" & _
  51.                     "<th>Role:</th><td>" & strDomainRole & "</td>" & _
  52.                     "</tr><tr>" & _
  53.                     "<th>DNS Host Name:</th><td>" & strDNSHostName & "</td>" & _
  54.                     "<th>Domain:</th><td>" & strDomain & "</td>" & _
  55.                     "</tr><tr>" & _
  56.                     "<th>Manufacturer:</th><td>" & strManufacturer & "</td>" & _
  57.                     "<th>Model:</th><td>" & strModel & "</td>" & _
  58.                     "</tr><tr>" & _
  59.                     "<th>Total Physical Memory:</th><td>" & FormatNumber(intTotalVisibleMemorySize/1024,0,,-1) & " MB</td>" & _
  60.                     "<th>Free Physical Memory:</th><td>" & FormatNumber(intFreePhysicalMemory/1024,0,,-1)  & " MB</td>" & _
  61.                     "</tr><tr>" & _
  62.                     "<th>Total Virtual Memory:</th><td>" & FormatNumber(intTotalVirtualMemorySize/1024,0,,-1) & " MB</td>" & _
  63.                     "<th>Free Virtual Memory:</th><td>" & FormatNumber(intFreeVirtualMemory/1024,0,,-1) & " MB</td>" & _
  64.                     "</tr><tr>" & _
  65.                     "<th>Install Date:</th><td>" & strInstallDate & "</td>" & _
  66.                     "<th>Last BootUp Time:</th><td>" & strBootDate & "</td>" & _
  67.                     "</tr>" & _
  68.                     "</table>"
  69.                    
  70.         Exit For
  71.     Next
  72.     OS_HTML = strHTML
  73. End Function
RAW Paste Data