Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub GetSerial(BYRef strSerial)
- Dim objItem, colItems
- Set colItems = objWMI.ExecQuery("Select IdentifyingNumber from Win32_ComputerSystemProduct")
- For Each objItem In colItems
- On Error Resume Next
- strSerial = HTMLEncode(objItem.IdentifyingNumber)
- Next
- End Sub
- ' ***************************************
- ' Returns a HTML report for the "Operating System/General" section
- ' ***************************************
- Function OS_HTML()
- Dim objItem, colItems
- Dim strHTML
- Dim strSerial
- Dim strDNSHostName,strDomain,strDomainRole,strManufacturer,strModel,strUserName
- GetSerial strSerial
- GetComputerSystemInfo strDNSHostName,strDomain,strDomainRole,strManufacturer,strModel,strUserName
- Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem")
- strHTML = "<h3>Current User: " & strUserName & "</h3>"
- For Each objItem In colItems
- Dim strComputerRole
- Dim strCaption,strBuildNumber,strInstallDate,strBootDate
- Dim intServicePackMajor,intServicePackMinor,intTotalVisibleMemorySize
- Dim intFreePhysicalMemory,intTotalVirtualMemorySize,intFreeVirtualMemory
- On Error Resume Next
- strCaption = HTMLEncode(objItem.Caption)
- strBuildNumber = HTMLEncode(objItem.BuildNumber)
- intServicePackMajor = objItem.ServicePackMajorVersion
- intServicePackMinor = objItem.ServicePackMinorVersion
- intTotalVisibleMemorySize = objItem.TotalVisibleMemorySize
- intFreePhysicalMemory = objItem.FreePhysicalMemory
- intFreeVirtualMemory = objItem.FreeVirtualMemory
- intTotalVirtualMemorySize = objItem.TotalVirtualMemorySize
- strInstallDate = FormatDate(objItem.InstallDate)
- strBootDate = FormatDate(objItem.LastBootUpTime)
- On Error Goto 0
- 'Const GroupDigits = "-1"
- strHTML = strHTML & "<table class=""Table"">" & _
- "<tr>" & _
- "<th>Operating System:</th><td>" & strCaption & "</td>" & _
- "<th>Service Pack:</th><td>" & intServicePackMajor & "." & intServicePackMinor & "</td>" & _
- "</tr><tr>" & _
- "<th>Serial Number:</th><td>" & strSerial & "</td>" & _
- "<th>Role:</th><td>" & strDomainRole & "</td>" & _
- "</tr><tr>" & _
- "<th>DNS Host Name:</th><td>" & strDNSHostName & "</td>" & _
- "<th>Domain:</th><td>" & strDomain & "</td>" & _
- "</tr><tr>" & _
- "<th>Manufacturer:</th><td>" & strManufacturer & "</td>" & _
- "<th>Model:</th><td>" & strModel & "</td>" & _
- "</tr><tr>" & _
- "<th>Total Physical Memory:</th><td>" & FormatNumber(intTotalVisibleMemorySize/1024,0,,-1) & " MB</td>" & _
- "<th>Free Physical Memory:</th><td>" & FormatNumber(intFreePhysicalMemory/1024,0,,-1) & " MB</td>" & _
- "</tr><tr>" & _
- "<th>Total Virtual Memory:</th><td>" & FormatNumber(intTotalVirtualMemorySize/1024,0,,-1) & " MB</td>" & _
- "<th>Free Virtual Memory:</th><td>" & FormatNumber(intFreeVirtualMemory/1024,0,,-1) & " MB</td>" & _
- "</tr><tr>" & _
- "<th>Install Date:</th><td>" & strInstallDate & "</td>" & _
- "<th>Last BootUp Time:</th><td>" & strBootDate & "</td>" & _
- "</tr>" & _
- "</table>"
- Exit For
- Next
- OS_HTML = strHTML
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement