Last active
June 3, 2024 04:34
-
-
Save john-clark/5239934 to your computer and use it in GitHub Desktop.
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
cscript wincomputerinfo.vbs |
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
Const wbemFlagReturnImmediately = &h10 | |
Const wbemFlagForwardOnly = &h20 | |
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | |
Set colItems = objWMIService.ExecQuery( _ | |
"SELECT * FROM Win32_ComputerSystemProduct",,48) | |
For Each objItem in colItems | |
strIdNumber = objItem.IdentifyingNumber | |
strCPUName = objItem.Name | |
' strSKU = objItem.SKUNumber | |
strUUID = objItem.UUID | |
strVendor = objItem.Vendor | |
' strVersion = objItem.Version | |
Next | |
Wscript.Echo "ServiceTag: " & strIdNumber | |
Wscript.Echo "CPU Name: " & strCPUName | |
' Wscript.Echo "SKUNumber: " & strSKU | |
Wscript.Echo "UUID: " & strUUID | |
Wscript.Echo "Vendor: " & strVendor | |
' Wscript.Echo "Version: " & strVersion | |
Set objNet = CreateObject("WScript.NetWork") | |
Wscript.Echo "Computer Name: " & objNet.ComputerName | |
Wscript.Echo "Domain Name: " & objNet.UserDomain | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | |
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled='TRUE'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly) | |
For Each objItem In colItems | |
strIPAddress = Join(objItem.IPAddress, ",") | |
Next | |
Wscript.Echo "IP: " & strIPAddress | |
Wscript.Echo "User Name: " & objNet.UserName | |
Set IE = CreateObject("InternetExplorer.Application") | |
Set WshShell = WScript.CreateObject("WScript.Shell") | |
IE.Navigate "https://cgdev.its.iastate.edu/report.aspx" | |
IE.Visible = True | |
Wscript.Sleep 2000 | |
IE.Document.All.Item("ServiceTag").Value = objItem.IdentifyingNumber | |
IE.Document.All.Item("Computer name").Value = objNet.ComputerName | |
IE.Document.All.Item("User name").Value = objNet.UserName | |
Call IE.Document.Forms(0).Submit() | |
Wscript.Echo | |
Wscript.Echo "Press Enter to continue . . ." | |
Wscript.StdIn.ReadLine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment