HTA Script To Gather Basic Machine Information

 

This HTA script will take a machine name from an input box and write some basic machine information to the active window including the machine name, the machines primary owner name, the machines manufacturer and model.

 

HTA Script:

 

<Html>

<Head>

 

<HTA:Application

Caption = Yes

Border = Thick

ShowInTaskBar = No

MaximizeButton = Yes

MinimizeButton = Yes>

 

<Script Language = VBScript>

sub Window_OnLoad

 

Set objDocument = self.Document

objDocument.open

objDocument.writeln "Basic Machine Information: "  & "<br>"

objDocument.writeln "<br>"

 

strComputer = InputBox ("Enter Machine Name")

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\Root\Cimv2")

 

Set colItems = objWMIService.ExecQuery ("Select * From Win32_ComputerSystem")

For Each objItem in colItems

 

objDocument.writeln("Machine Name: " & objItem.Name)

objDocument.writeln "<br>"

objDocument.writeln("PrimaryOwnerName: " & objItem.PrimaryOwnerName)

objDocument.writeln "<br>"

objDocument.writeln("Manufacturer: " & objItem.Manufacturer)

objDocument.writeln "<br>"

objDocument.writeln("Model: " & objItem.Model)

objDocument.writeln "<br>"

Next

 

End Sub

 

</script>

</Head>

<Body>

</Body>

</Html>

 

Published Sunday, February 25, 2007 10:03 AM by dhite
Filed under:

Comments

No Comments