Created
April 3, 2016 15:54
-
-
Save Davnit/584f4fef95d99dcf133ee28ff62ad68f to your computer and use it in GitHub Desktop.
System Info Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'System Information | |
' Appears to be incomplete. | |
Sub Data() | |
Script("Name") = "SystemInfo" | |
Script("Author") = "PyroManiac" | |
Script("Major") = 1 | |
Script("Minor") = 0 | |
Script("Revision") = 0 | |
Script("UpdateLocation") = vbNullString | |
End Sub | |
Function GetString() | |
Set dicProductType = CreateObject("Scripting.Dictionary") | |
dicProductType.Add 1, "Workstation" | |
dicProductType.Add 2, "Domain Controller" | |
dicProductType.Add 3, "Standalone Server" | |
Set dicProcArch = CreateObject("Scripting.Dictionary") | |
dicProcArch.Add 0, "x86" | |
dicProcArch.Add 1, "MIPS" | |
dicProcArch.Add 2, "Alpha" | |
dicProcArch.Add 3, "PowerPC" | |
dicProcArch.Add 6, "Intel Itanium" | |
dicProcArch.Add 9, "x64" | |
Set objWMI = GetObject("winmgmts:\\localhost\root\cimv2") | |
Set colOS = objWMI.InstancesOf("Win32_OperatingSystem") | |
Set colPR = objWMI.InstancesOf("Win32_Processor") | |
For Each objOS In colOS | |
totalMemory = (objOS.TotalVirtualMemorySize / 1024) | |
If totalMemory > 1024 Then | |
totalMemory = Round(totalMemory / 1024) & " GB" | |
Else | |
totalMemory = Round(totalMemory) & " MB" | |
End If | |
sysConfig = dicProductType.Item(objOS.ProductType) | |
OSInfo = Trim(objOS.Caption) & " Build " & objOS.BuildNumber | |
Exit For | |
Next | |
For Each objPR In colPR | |
procName = Split(Replace(objPR.Name, Space(4), Space(1)), " @")(0) | |
procSpeed = objPR.CurrentClockSpeed | |
If procSpeed > 1000 Then | |
procSpeed = (procSpeed / 1000) & " GHz" | |
Else | |
procSpeed = procSpeed & " MHz" | |
End If | |
Exit For | |
Next | |
GetString = StringFormat("This system is configured as a {0} running {1}. It is powered by an {2} running at {3} and {4} of RAM.", _ | |
Array(sysConfig, OSInfo, procName, procSpeed, totalMemory)) | |
End Function | |
Function StringFormat(ByRef str, arrArgs) | |
For x = 0 To UBound(arrArgs) | |
str = Replace(str, "{" & x & "}", arrArgs(x)) | |
Next | |
StringFormat = str | |
End Function | |
Sub testGeneral() | |
AddChat vbWhite, "Printing system information..." | |
set dicProductType = CreateObject("Scripting.Dictionary") | |
dicProductType.Add 1, "Workstation" | |
dicProductType.Add 2, "Domain Controller" | |
dicProductType.Add 3, "Standalone Server" | |
set objWMIDateTime = CreateObject("WbemScripting.SWbemDateTime") | |
set objWMI = GetObject("winmgmts:\\localhost\root\cimv2") | |
set colOS = objWMI.InstancesOf("Win32_OperatingSystem") | |
for each objOS in colOS | |
AddChat vbWhite, "Host Name: " & objOS.CSName | |
AddChat vbWhite, "OS Name: " & objOS.Caption | |
AddChat vbWhite, "OS Version: " & objOS.Version & " Build " & objOS.BuildNumber | |
AddChat vbWhite, "OS Manufacturer: " & objOS.Manufacturer | |
AddChat vbWhite, "OS Configuration: " & dicProductType.Item(objOS.ProductType) | |
AddChat vbWhite, "OS Build Type: " & objOS.BuildType | |
AddChat vbWhite, "Registered Owner: " & objOS.RegisteredUser | |
AddChat vbWhite, "Registered Organization: " & objOS.Organization | |
AddChat vbWhite, "Product ID: " & objOS.SerialNumber | |
objWMIDateTime.Value = objOS.InstallDate | |
AddChat vbWhite, "Original Install Date: " & objWMIDateTime.GetVarDate | |
objWMIDateTime.Value = objOS.LastBootUpTime | |
AddChat vbWhite, "System Up Time: " & objWMIDateTime.GetVarDate | |
AddChat vbWhite, "Windows Directory: " & objOS.WindowsDirectory | |
AddChat vbWhite, "System Directory: " & objOS.SystemDirectory | |
AddChat vbWhite, "BootDevice: " & objOS.BootDevice | |
AddChat vbWhite, "System Locale: " & objOS.Locale | |
AddChat vbWhite, "Time Zone: " & "GMT" & objOS.CurrentTimezone | |
AddChat vbWhite, "Total Physical Memory: " & _ | |
round(objOS.TotalVisibleMemorySize / 1024) & " MB" | |
AddChat vbWhite, "Available Physical Memory: " & _ | |
round(objOS.FreePhysicalMemory / 1024) & " MB" | |
AddChat vbWhite, "Page File: Max Size: " & _ | |
round(objOS.TotalVirtualMemorySize / 1024) & " MB" | |
AddChat vbWhite, "Page File: Available: " & _ | |
round(objOS.FreeVirtualMemory / 1024) & " MB" | |
next | |
set colCS = objWMI.InstancesOf("Win32_ComputerSystem") | |
for each objCS in colCS | |
AddChat vbWhite, "System Manufacturer: " & objCS.Manufacturer | |
AddChat vbWhite, "System Model: " & objCS.Model | |
AddChat vbWhite, "System Type: " & objCS.SystemType | |
AddChat vbWhite, "Domain: " & objCS.Domain | |
AddChat vbWhite, "Processor(s): " & objCS.NumberofProcessors & _ | |
" Processor(s) Installed." | |
next | |
intCount = 0 | |
set colProcs = objWMI.InstancesOf("Win32_Processor") | |
for each objProc in colProcs | |
intCount = intCount + 1 | |
AddChat vbWhite, vbTab & "[" & intcount & "]: " & _ | |
objProc.Caption & " ~" & objProc.MaxClockSpeed & "Mhz" | |
next | |
set colBIOS = objWMI.InstancesOf("Win32_BIOS") | |
for each objBIOS in colBIOS | |
AddChat vbWhite, "BIOS Version: " & objBIOS.Version | |
next | |
End Sub | |
Sub testProcessor() | |
AddChat vbWhite, "Printing processor information..." | |
On Error Resume Next | |
Set objWMI = GetObject("winmgmts:\\localhost\root\cimv2") | |
Set colProcs = objWMI.InstancesOf("Win32_Processor") | |
AddChat vbWhite, "Found " & colProcs.Count & " processors:" | |
For Each objProc In colProcs | |
intCount = intCount + 1 | |
AddChat vbWhite, vbTab & intCount & ": " & objProc.Caption | |
AddChat vbWhite, vbTab & vbTab & " Manufacturer: " & objProc.Manufacturer | |
AddChat vbWhite, vbTab & vbTab & " Name: " & objProc.Name | |
AddChat vbWhite, vbTab & vbTab & " Description: " & objProc.Description | |
AddChat vbWhite, vbTab & vbTab & " ProcessorID: " & objProc.ProcessorID | |
AddChat vbWhite, vbTab & vbTab & " Architecture: " & objProc.Architecture | |
AddChat vbWhite, vbTab & vbTab & " AddressWidth: " & objProc.AddressWidth | |
AddChat vbWhite, vbTab & vbTab & " NumberOfCores: " & objProc.NumberOfCores | |
AddChat vbWhite, vbTab & vbTab & " DataWidth: " & objProc.DataWidth | |
AddChat vbWhite, vbTab & vbTab & " Family: " & objProc.Family | |
AddChat vbWhite, vbTab & vbTag & " Current Clock Speed: " & objProc.CurrentClockSpeed | |
AddChat vbWhite, vbTab & vbTab & " MaximumClockSpeed: " & objProc.MaxClockSpeed | |
Next | |
Err.Clear | |
End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment