Jump to content

can i have a little help with a vbs script please?


Recommended Posts

thats fantastic! cant wait to see it running remotely as well it will be very cool indeed :thumbup

now theres just the other few WMI's to interrogate and the remote part to add and its nearly done right? :D

also can you just confirm my suspicions?...if this was running remotely i think this would use port 135 is this correct?

thanks

Edited by eyeball
Link to comment
Share on other sites


I do not know what the correct ports is.

also can you just confirm my suspicions?...if this was running remotely i think this would use port 135 is this correct?

I have added a Inputbox that allow you to add the Computer Name on the network that you want to run this on. I also added the WMI CDROM and Usb to this one.

Updated HTA SFX SystemReport_V3

Removed as not updating this, I have made it a vbs, all you have to do is change

this SystemReport_V2.vbs.txt to SystemReport_V2.vbs, this is a winrar file.

Link to SystemReport_V2.vbs.rar

Edited by gunsmokingman
Link to comment
Share on other sites

Gunsmokingman, as per your request, here's the script after I "touched" it :):

'  // **************************************************
' //
' // Variables for the WMI class

Dim strComputer : strComputer = "."
Dim objWMIService


' // **************************************************
' //
' // Objects for the script

Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim SD : SD = Act.ExpandEnvironmentStrings("%SystemDrive%")
Dim CName : CName = Act.ExpandEnvironmentStrings("%ComputerName%")
Dim FName : FName = (SD & "\" & CName & ".txt")
Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%")


' // **************************************************
' //
' // HTA Variables

Dim HtaStyle1, HtaStyle2, Ln1, S_3, S_5 , Table1,TdBig, TdSmall, V : V = vbCrLf
S_5 = Space(5) : S_3 = Space(3) : Ln1 = Chr(171) & " --------------------------------- " & Chr(187)
HtaStyle1 = "font:8.75pt;font-family:Palatino Linotype;color:#000080;"
HtaStyle2 = "font:8.75pt;font-family:Palatino Linotype;color:#808080;"
HtaStyle1 = "<TD Style=""" & HtaStyle1 & """ Width=""135""><B> "
HtaStyle2 = "<TD Style=""" & HtaStyle2 & """ Width=""275""><B> "
TdBig = "<TD Style=""font:8.75pt;font-family:Palatino Linotype;color:#000080;text-align:CENTER; "" WIDTH=""450"">"
TdSmall = "<TD Style=""font:8.75pt;font-family:Palatino Linotype;color:#009000;text-align:CENTER;"" WIDTH=""350"">"
Table1 = "<TABLE BORDER=""1"">"


' // **************************************************
' //
' // Variables To Convert Size

Dim GB, MB : GB = 1024 * 1024 * 1024 : MB = 1024 * 1024


' // **************************************************
' //
' // Convert WMI Date Format

Dim aDate, aDate1, aDate2, aDate2a, aDate3
Dim BDate, BDate1, BDate2, BDate2a, BDate3


' // **************************************************
' //
' // WMI Object

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")


' // **************************************************
' //
' // Message to let user know that the script is starting

Act.Popup "Preparing to run System Report on " & CName & V &_
"This will take a few minutes to complete.", 5,"System Report", 0 + 32


' // **************************************************
' //
' // WMI Computer Class

Dim Computer, ObjComp , ObjCompHta
Set Computer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each ObjComp in Computer
Dim CpuCount: CpuCount = ObjComp.NumberOfProcessors
Dim Ram : Ram = FormatNumber(ObjComp.TotalPhysicalMemory / MB,1)

'''' --> HTA OUTPUT Computer

ObjCompHta = ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Computer Information</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Logon On Name</TD>" & V &_
HtaStyle2 & UCase(UName)& "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Computer Name</TD>" & V &_
HtaStyle2 & UCase(CName)& "</TD></TABLE>" & V &_
"<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Mother Board Information</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Manufacturer</TD>" & V &_
HtaStyle2 & UCase(ObjComp.Manufacturer) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Description</TD>" & V &_
HtaStyle2 & UCase(ObjComp.Description) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Model</TD>" & V &_
HtaStyle2 & UCase(ObjComp.Model) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Installed Ram</TD>" & V &_
HtaStyle2 & Ram & " MB" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "SystemType</TD>" & V &_
HtaStyle2 & UCase(ObjComp.SystemType) & "</TD></TABLE>" & _
"</TD></TABLE>")
Next


' // **************************************************
' //
' // WMI Bios Class

Dim Bios, objBios , objBiosHta
Set Bios = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS",,48)

'''' --> START THE WMI Bios Class

For Each objBios in Bios
BDate = Left(objBios.ReleaseDate,8)
BDate1 = Left(BDate,4) : BDate2 = Right(BDate,4)
BDate2a = Left(BDate2,2) : BDate3 = Right(BDate2,2)
Dim BiosDate : BiosDate = BDate1 & "-" & BDate2a & "-" & BDate3

'''' --> HTA OUTPUT objBios

objBiosHta = ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Bios Information</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Bios Release Date</TD>" & HtaStyle2 & BiosDate & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Bios Made By</TD>" & HtaStyle2 & UCase(objBios.Manufacturer) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Bios Version</TD>" & HtaStyle2 & UCase(objBios.Version) & "</TD></TABLE>" & _
"</TD></TABLE>")
Next


' // **************************************************
' //
' // WMI OsInfo Class

Dim OsInfo , objOs, objOsHta
Set OsInfo = objWMIService.ExecQuery( "SELECT * FROM Win32_OperatingSystem",,48)
For Each objOs in OsInfo
aDate = Left(objOs.InstallDate,8)
aDate1 = Left(aDate,4) : aDate2 = Right(aDate,4)
aDate2a = Left(aDate2,2) : aDate3 = Right(aDate2,2)
Dim WinDate, N1, ServicePack : N1 = Split(objOs.Name,"|")
ServicePack = UCase(objOs.CSDVersion)
WinDate = aDate1 & "-" & aDate2a & "-" & aDate3

'''' --> HTA OUTPUT OsInfo

objOsHta = ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Operating System Information</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "OS Name</TD>" & HtaStyle2 & UCase(N1(0)) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "OS Version</TD>" & HtaStyle2 & UCase(objOs.Version) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "OS Install Date</TD>" & HtaStyle2 & WinDate & "</TD></TABLE>" & _
"</TD></TABLE>")
Next


' // **************************************************
' //
' // Collects the Security Updates and Service Pack currently installed

Dim Cnt, i, KbInfo, KbInfoHta, RptHta, RptKB, RP_1, RP_2, RP_3, RP_4, RP_5
Dim MsUpS : Set MsUpS = CreateObject("Microsoft.Update.Session")
Dim SeekUp : Set SeekUp = MsUpS.CreateUpdateSearcher
Dim SeekR : Set SeekR = SeekUp.Search("Type='Software'")
Dim StrUP : Set StrUP = SeekR.Updates
KbInfo = ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Service Pack Information</B></TD></TABLE>" & Table1 & HtaStyle1 & V &_
"Service Pack Installed</TD>" & HtaStyle2 & ServicePack & "</TD></TABLE>")
For i = 0 to StrUP.Count - 1
RP_1 = StrUP.Item(i).Title
If InStr(RP_1,"Security Update") Then
Cnt = StrUP.Count
RP_2 = Replace(RP_1,"Security Update for Windows XP","XP")
RP_3 = Replace(RP_2,"Security Update for"," ")
RP_4 = Replace(RP_3,"for Windows XP","XP")
RP_5 = Replace(RP_4,"Microsoft .NET Framework, Version 1.1 Service Pack 1","Ms.NetFrameWork-Ver-1.1-SP1")
RptKB = RP_5
RptHta = RptHta & V & S_3 & Table1 & HtaStyle1 & "Security Update Name</TD>" & V & S_3 & HtaStyle2 & RptKB & "</TD></TABLE>"
End If
Next

'''' --> Security Update information for the HTA

KbInfo = KbInfo & V & S_3 & ("<TABLE Bgcolor="""" Style="""">" & TdBig & V & S_3 &_
Table1 & TdSmall & "<B>Installed Security Updates Total = " & Cnt & "</B></TD></TABLE>" & V & S_3 &_
Table1 & TdSmall & "<B>This does not include Languages Updates</B></TD></TABLE>")
KbInfoHta = (KbInfo & V & S_3 & RptHta & "</TD></TABLE>")


' // **************************************************
' //
' // WMI CpuInfo Class

Dim CpuInfo, objCPU , CpuInfoHta
Set CpuInfo = objWMIService.ExecQuery( "SELECT * FROM Win32_Processor",,48)
For Each objCPU in CpuInfo

'''' --> HTA OUTPUT CpuInfo

CpuInfoHta = ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>CPU Information</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Manufacturer</TD>" & V &_
HtaStyle2 & UCase(objCPU.Manufacturer) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Processor Name</TD>" & V &_
HtaStyle2 & UCase(objCPU.Name) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Number Of CPU`s</TD>" & V &_
HtaStyle2 & CpuCount & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Cpu Details</TD>" & V &_
HtaStyle2 & UCase(objCPU.Description) & "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Processor Speed</TD>" & V &_
HtaStyle2 & objCPU.MaxClockSpeed & " MHZ" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "L2 Cache Size</TD>" & V &_
HtaStyle2 & objCPU.L2CacheSize & "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "L2 Cache Speed</TD>" & V &_
HtaStyle2 & objCPU.L2CacheSpeed & " MHZ" & "</TD></TABLE>" & V &_
"</TD></TABLE>")
Next


' // **************************************************
' //
' // WMI HDinfo Class

Dim HDinfo, ObjHD, HDinfoHta
Set HDinfo = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive",,48)
For Each ObjHD In HDinfo
Dim HDS, HDId : HDS = Left(ObjHD.Size / GB,5) : HDId = Right(ObjHD.DeviceID,14)

'''' --> HTA OUTPUT HDinfoHta

HDinfoHta = HDinfoHta & ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Hard Drive Information</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Hard Drive Model</TD>" & V &_
HtaStyle2 & UCase(ObjHD.Model) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Device ID</TD>" & V &_
HtaStyle2 & UCase(HDId) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Hard Drive Size</TD>" & V &_
HtaStyle2 & HDS & " GB" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Number Of Partitions</TD>" & V &_
HtaStyle2 & ObjHD.Partitions & "</TD></TABLE>" & V &_
"</TD></TABLE>")
Next


' // **************************************************
' //
' // WMI Partition Class

Dim Partition , ObjPart, PartitionHta
Set Partition = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk where DriveType = 3")
For Each ObjPart In Partition
Dim Pfs, Ps, UsedSpace,Small, Large
Ps = Left(ObjPart.Size /GB,5) : Pfs = Left(ObjPart.FreeSpace / GB,5) : UsedSpace = Ps - Pfs
If UsedSpace < 1 Then
Ps = Left(ObjPart.Size /MB,5): Pfs = Left(ObjPart.FreeSpace / MB ,5) : UsedSpace = Ps - Pfs : Small = Left(UsedSpace,5)
PartitionHta = PartitionHta & ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Partition Information Less than a GigaByte of Used Space</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Partition Letter</TD>" & V &_
HtaStyle2 & ObjPart.Name & "\" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Volume Name</TD>" & V &_
HtaStyle2 & UCase(ObjPart.VolumeName) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Total Size</TD>" & V &_
HtaStyle2 & Ps & " MB" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Free Space</TD>" & V &_
HtaStyle2 & Pfs & " MB" & "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Used Space</TD>" & V &_
HtaStyle2 & Small & " MB" & "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "File System</TD>" & V &_
HtaStyle2 & UCase(ObjPart.FileSystem)& "</TD></TABLE>" & V &_
"</TD></TABLE>")
Else
Large = Left(UsedSpace,5)
PartitionHta = PartitionHta & ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & V &_
"<B>Partition Information More than a GigaByte of Used Space</B></TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Partition Letter</TD>" & V &_
HtaStyle2 & ObjPart.Name & "\" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Volume Name</TD>" & V &_
HtaStyle2 & UCase(ObjPart.VolumeName) & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Total Size</TD>" & V &_
HtaStyle2 & Ps & " GB" & "</TD></TABLE>" & _
Table1 & HtaStyle1 & "Free Space</TD>" & V &_
HtaStyle2 & Pfs & " GB" & "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "Used Space</TD>" & V &_
HtaStyle2 & Large & " GB" & "</TD></TABLE>" & V &_
Table1 & HtaStyle1 & "File System</TD>" & V &_
HtaStyle2 & UCase(ObjPart.FileSystem)& "</TD></TABLE>" & V &_
"</TD></TABLE>")
End If
Next


' // **************************************************
' //
' // Start the HTA output

Dim MkHta : MkHta = SD & "\ComputerInfo_V1.Hta"
Dim Ts : Set Ts = Fso.CreateTextFile(MkHta)
Dim ButtonStyle, BodyStyle, Button, ScriptJS, ScriptVBS, StyleHta, TopVar


' // **************************************************
' //
' // Body background for the HTA CSS Style

BodyStyle = "Body.Normal {font:10.75pt;font-family:Palatino-Linotype;color:#004040;background-color:#ed0926;filter:" & V & S_3 &_
"progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#eeeeee',endColorStr='#d0d0d0');" & V & S_3 &_
"padding-top:1;padding-bottom:1;Text-Align:Center;Valign:Top;} "


' // **************************************************
' //
' // Button back ground for the HTA CSS Style

ButtonStyle = " .Button {font-family:Palatino-Linotype;font-size :8.75pt;font-weight:Bold-Italic;" & V & S_3 &_
"line-height:110%;color:#000080;background-color:#6CA2E3;filter:progid:DXImageTransform.Microsoft.Gradient" & V & S_3 &_
"(GradientType=0,StartColorStr='#c0bcb6',endColorStr='#ffffff');width:91;height:25;" & V & S_3 &_
"padding-top:1;padding-bottom:1;padding-left:5;padding-right:5;margin-right:5;margin-left:5;}"


' // **************************************************
' //
' // CSS Variables for the HTA

StyleHta = S_3 & V & S_3 & "<style type=""text/css"">" & V &_
S_3 & BodyStyle & V & S_3 & ButtonStyle & V & S_3 & "</STYLE>"


' // **************************************************
' //
' // JS script for the HTA

ScriptJS = "<script language=javascript>" & V & S_3 & _
"window.resizeTo (535,791), window.moveTo (250,75);" & V & S_3 & _
"var V=('\\'), Hidden =(""0""), Normal = (""1""), Min = (""2""),Max = (""3"");" & V & S_3 & _
"var Fso = new ActiveXObject(""Scripting.FileSystemObject"");" & V & S_3 & _
"var Act = new ActiveXObject(""Wscript.Shell"");" & V & S_3 & _
"var enumItems = new Enumerator(Fso.Drives);" & V & S_3 & _
"function DeFragDrv(Drv)" & V & S_3 & _
" { for (; !enumItems.atEnd(); enumItems.moveNext()) " & V & S_3 & _
" { var objItem = enumItems.item(), Drv_L = objItem.DriveLetter;" & V & S_3 & _
" if ( objItem.IsReady == true); if ( objItem.DriveType == 2)" & V & S_3 & _
" { var HD_Report =""Did You Want To Defrag This Drive"" +'\n'+ "" Drive : "" +Drv_L+ "":"" +V " & V & S_3 & _
" var DefragIt = confirm(HD_Report);" & V & S_3 & _
" if ( DefragIt == true ){Act.Run(""Defrag "" +Drv_L+ "":"" +V+ "" -F"",Min,true);}}}}" & V & S_3 & _
"function ClnMgr()" & V & S_3 & _
" {Act.run (""cleanmgr /sagerun:99"",Normal , true);}" & V & S_3 & _
"function DrvDeFrag(Drv)" & V & S_3 & _
"{ for (; !enumItems.atEnd(); enumItems.moveNext())" & V & S_3 & _
"{ var objItem = enumItems.item(), Drv_L = objItem.DriveLetter;" & V & S_3 & _
" if ( objItem.IsReady == true); if ( objItem.DriveType == 2)" & V & S_3 & _
"{Act.Run(""Defrag "" + objItem.DriveLetter + "":"" + V + "" -F"",Min,true);}}}" & V & S_3 & _
"function ClnMgrDefrag(Drv)" & V & S_3 & _
"{Act.run (""cleanmgr /sagerun:99"",Normal , true),DrvDeFrag(), alert(""Completed Clean Manager and Defrag"");}" & V & S_3 & _
"function DrvDeFrag(Drv)" & V & S_3 & _
"{ for (; !enumItems.atEnd(); enumItems.moveNext())" & V & S_3 & _
"{ var objItem = enumItems.item(), Drv_L = objItem.DriveLetter;" & V & S_3 & _
" if ( objItem.IsReady == true); if ( objItem.DriveType == 2)" & V & S_3 & _
"{Act.Run(""Defrag "" + objItem.DriveLetter + "":"" + V + "" -F"",Min,true);}}}" & V & S_3 & _
"function ClnMgrDefrag(Drv)" & V & S_3 & _
"{Act.run (""cleanmgr /sagerun:99"",Normal , true),DrvDeFrag(), alert(""Completed Clean Manager and Defrag"");}" & V & S_3 & _
"</SCRIPT>"


' // **************************************************
' //
' // Make the actual HTA

Ts.WriteLine S_3 & StyleHta & V & S_3 & ScriptJS
Ts.WriteLine S_3 & "<Body" & " CLASS=""Normal"">" & V &_
"<B>" & Ucase(CName & " Information")
Ts.WriteLine S_3 & "<Table><TD CLass="""">"
Ts.WriteLine S_3 & "<Input Type=""Button"" Class=""Button"" Value=""CleanManager"" OnClick=""ClnMgr()""></TD><TD CLass="""">"
Ts.WriteLine S_3 & "<Input Type=""Button"" Class=""Button"" Value=""Defrag A HD"" OnClick=""DeFragDrv()""></TD><TD CLass="""">"
Ts.WriteLine S_3 & "<Input Type=""Button"" Class=""Button"" Value=""Run Both"" OnClick=""ClnMgrDefrag()""></TD><TD CLass=""""></TABLE>"
Ts.WriteLine S_3 & ObjCompHta
Ts.WriteLine S_3 & objOsHta
Ts.WriteLine S_3 & KbInfoHta
Ts.WriteLine S_3 & objBiosHta
Ts.WriteLine S_3 & CpuInfoHta
Ts.WriteLine S_3 & HDinfoHta
Ts.WriteLine S_3 & PartitionHta
Ts.Close


' // **************************************************
' //
' // Run the HTA, then ask to delete or keep the HTA

Act.Run(MkHta),1,True
Dim ZZ1 : ZZ1 = Act.Popup("Did you want to keep this file?" & V & MkHta &_
V & "Yes to Keep" & S_5 & "No to delete" & V & "If you do not make a select in" &_
V & "One minute then it saves the file", 61,"Keep Or Delete", 4 + 48)
If ZZ1 = 7 Then
Fso.DeleteFile(MkHta)
End If


' // **************************************************
' //
' // Delete the VBS file

If Fso.FileExists(SD & "\SystemReport.vbs") Then Fso.DeleteFile(SD & "\SystemReport.vbs") End If

And attached for those of us who don't like the copy/paste from the code window.

gunsmokingman.txt

Link to comment
Share on other sites

Here is a updated version of the script

Changes

1:\ I have added the WMI Class that RoqueSpear wrote

2:\ It in the format that Cluberti wrote

3:\ I have move the Clean Manager and Defrag Buttons, they sit above the Hard Drive Information

4:\ I have change the order in which the information appears

5:\ I have increase the size of the width

Updated HTA SFX SystemReport_V3

Removed as not updating this, I have made it a vbs, all you have to do is change

this SystemReport_V3.vbs.txt to SystemReport_V3.vbs, this is a winrar file.

Link to SystemReport_V3.vbs.rar

Edited by gunsmokingman
Link to comment
Share on other sites

wow this is looking amazing! the software is in there too! gonna try this on a domain soon (not now its nearly 2 in the morning lol) but im sure it will work fine for interrogating remote pc's. also ill find out the port it uses whilst im at it :)

really this is great i love it :)

Link to comment
Share on other sites

I will be adding the WMI stuff that you had scripted to this after you have ran that and report if it work on the network. Do you like the way I have the way it displays the information? If you see any spelling mistakes please post, so I can correct them.

Link to comment
Share on other sites

HI Gsm,

the info is displayed fine :) and i will look for spelling mistakes after i hav posted this...l

i ran this on virtual pc (i have a server and a client running on their own mini network so no outside interferance) and on both it gave me an error, could be something to do with the fact they are on a domain? anyway it is:

line - 175

char - 15

error - 0x8024402c

code - 8024402c

source (null)

for some reason my notepad has "goto" greyed out so i cant even check what line this is :S

Edited by eyeball
Link to comment
Share on other sites

I am not sure how scripts run in virtual pc this may be causing a error I can not say for sure on this. This is the line causing the problem, I am working on using the WMI Class to list the updates.

Dim SeekR : Set SeekR = SeekUp.Search("Type='Software'")

I use a program called Vbsedit to write my scripts, Version 3.3 this is a evaluation version and it not bad but when you debug it it has a delay to it before it runs. I use the 3.0 version as the debug has no delay, in the evaluation version.

Edited by gunsmokingman
Link to comment
Share on other sites

ok Gsm it works now :)

iv ran it on the client from the server no problems.

i found it needs the following ports and protocols on the client to be in the firewall exceptions:

tcp 135

udp 135

tcp 1036

one thing, can you make it so the file created is named the same as the hostname of the pc it scanned?

thank you :)

Link to comment
Share on other sites

That is a easy one to do

Change this

'  // **************************************************
'
' // --> Start the Hta output

Dim MkHta : MkHta = SD & "\ComputerInfo_V1.Hta"

To this

'  // **************************************************
'
' // --> Start the Hta output

Dim MkHta : MkHta = SD & "\" & Comp(0) & ".Hta"

Or This

'  // **************************************************
'
' // --> Start the Hta output

Dim MkHta : MkHta = SD & "\" & NameTheComputer & ".Hta"

Also if there are spaces in the Computer Name then you should change this

'  // --> Runs the Hta and then ask to delete the Hta or keep the Hta

Act.Run(MkHta),1,True

To this

'  // --> Runs the Hta and then ask to delete the Hta or keep the Hta

Act.Run(Chr(34) & MkHta & Chr(34)),1,True

In the next version I will make the above changes added to it.

Did you want me to have the HTA go to the User desktop or is %systemdrive% Ok?

Link to comment
Share on other sites

I have made some changes, this is now a HTA that runs the script, as the script is running it displays what WMI class is being added to the HTA that the script produces. I have also change the final HTA name to the computer thatit being run on. I hope you like this version.

Save As SystemReport_V1.hta

Updated HTA SFX SystemReport_V3

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<TITLE>  System Report Version 1</TITLE>
<HTA:APPLICATION ID="System Report Version 1" SCROLL="No"
SCROLLFLAT ="No" SingleInstance="Yes" ShowInTaskbar="Yes" SysMenu="Yes" MaximizeButton="No" MinimizeButton="No"
Border="Thin" BORDERSTYLE ="complex" INNERBORDER ="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="System Report Version 1"
Icon="Hta2.ico"><head>
<!-- =======================SCRIPT SEPARATOR ======================= -->
<!-- FOR A TRANSPARENT BACK GROUND -->
<!--[if !mso]> <style> v\:* {behavior:url(#default#VML);}o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);} .shape{behavior:url(#default#VML);}</style> <![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument><w:PunctuationKerning/><w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility><w:BreakWrappedTables/><w:SnapToGridInCell/> <w:WrapTextWithPunct/><w:UseAsianBreakRules/>
<w:DontGrowAutofit/> </w:Compatibility><w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument></xml><![endif]--><!--[if gte mso 10]><![endif]-->
<!--[if !mso]><style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);}</style><![endif]--><!--[if gte vml 1]>
<v:shapetype id="_x0000_t75"coordsize="21600,21600"o:spt="75"o:preferrelative="t"path="m@4@5l@4@11@9@11@9@5xe"filled="f"stroked="f">
<![if !vml]><img src="" v:shapes="_x0000_i1026"><![endif]><![endif]-->
<!-- =======================SCRIPT SEPARATOR ======================= -->
<STYLE type="text/css">

/* CLASS BODY CSS */
Body.Normal {font:10.75pt;font-family:Palatino Linotype;color:#004040;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#eeeeee',endColorStr='#d0d0d0');padding-top:1;padding-bottom:1;}

/* THIS CAN BE USED FOR ANT THING THAT NEEDS A CLASS CSS */
.Button {font-family:Palatino Linotype;font-size:10.75pt;font-weight:Bold;line-height:110%;color:#004040;Text-Align:CENTER;filter:
progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#eeeeee',endColorStr='#64a0bf');width:55;height:25;}

/* CLASS TD CSS */
TD.Style1 {font-family:Palatino Linotype;font-size:8.75pt;font-weight:Bold;line-height:110%;color:#000088;Text-Align:;filter:
progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#d0d0d0',EndColorStr='#eeeeee')}

</STYLE></head>

<!-- =======================SCRIPT SEPARATOR ======================= -->
<!-- RESIZE THE WINDOW AND MOVE IT -->
<script language="VBScript"> window.ResizeTo 441,252 : window.moveTo 250,75 </Script>

<!-- =======================SCRIPT SEPARATOR ======================= -->

<script language="VBScript">
'''' ****************************************************************************************************
*******
' // --> OBJECTS FOR THE SCRIPT
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim SD : SD = Act.ExpandEnvironmentStrings("%SystemDrive%")
Dim CName : CName = Act.ExpandEnvironmentStrings("%ComputerName%") '''' --> Local Computer Only
Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%")

'''' ****************************************************************************************************
*******
' // --> VARIBLES AND OBJECTS FOR THE SCRIPT AND HTA
Dim HtaStyle1, HtaStyle2, Ln1, Ln2, S_3, S_5 , Table1, TableTop, TdBig, TdSmall, V : V = vbCrLf
S_5 = Space(5) : S_3 = Space(3) : Ln1 = Chr(171) & " --------------------------------- " & Chr(187)
Ln2 = V & S_3
HtaStyle1 = "font:8.75pt;font-family:Palatino Linotype;color:#000080;"
HtaStyle2 = "font:8.75pt;font-family:Palatino Linotype;color:#808080;"
HtaStyle1 = "<TD Style=""" & HtaStyle1 & """ Width=""135""><B> "
HtaStyle2 = "<TD Style=""" & HtaStyle2 & """ Width=""335""><B> "
TdBig = "<TD Style=""font:8.75pt;font-family:Palatino Linotype;color:#000080;text-align:CENTER; "" WIDTH=""470"">"
TdSmall = "<TD Style=""font:8.75pt;font-family:Palatino Linotype;color:#009000;text-align:CENTER;"" WIDTH=""370"">"
Table1 = "<TABLE BORDER=""1"">"
TableTop = "<TABLE Bgcolor="""" Style="""">"

'''' ****************************************************************************************************
*******
' // --> Variables To Convert Size
Dim GB, MB : GB = 1024 * 1024 * 1024 : MB = 1024 * 1024

'''' ****************************************************************************************************
*******
' // --> Convert Wmi Date Format
Dim aDate, aDate1, aDate2, aDate2a, aDate3
Dim BDate, BDate1, BDate2, BDate2a, BDate3

'''' ****************************************************************************************************
*******
' // --> MAKE THE REST VBS
Function MakeSleep
' // --> HTA DOES NOT SUPPORT WSCTIPT.SLEEP THIS IS MY WORK AROUND
' // --> ONE SECOND DELAY
Set Ts = Fso.CreateTextFile(SD & "\Rest1.Vbs", 2, True)
Ts.WriteLine "Wscript.sleep 1000" : Ts.close
' // --> TWO SECOND DELAY
Set Ts = Fso.CreateTextFile(SD & "\Rest2.Vbs", 2, True)
Ts.WriteLine "Wscript.sleep 2000" : Ts.close
End Function

'''' ****************************************************************************************************
*******
'''' --> DELETES THE FILES IF TRUE
Function ExitHta()
Act.Run("%Comspec% /c Taskkill.exe /f /im Wscript.exe" ),0,True
If Fso.FileExists(SD & "\Rest1.Vbs") Then
Fso.DeleteFile(SD & "\Rest1.Vbs")
End If
If Fso.FileExists(SD & "\Rest2.Vbs") Then
Fso.DeleteFile(SD & "\Rest2.Vbs")
End If
If Fso.FileExists(SD & "\Hta2.ico") Then
Fso.DeleteFile(SD & "\Hta2.ico")
End If
If Fso.FileExists(SD & "\Run001.png") Then
Fso.DeleteFile(SD & "\Run001.png")
End If
If Fso.FileExists(SD & "\SystemReport_V1.Hta") Then
Fso.DeleteFile(SD & "\SystemReport_V1.Hta")
End If
Act.Run("%Comspec% /c Taskkill.exe /f /im Wscript.exe" ),0,True
Act.Run("%Comspec% /c Taskkill.exe /f /im Mshta.exe"),0,True
Window.Close
End Function

'''' ****************************************************************************************************
*******
' // --> GET THE COMPUTER NAME VARIBLES
Dim Msg1, Msg2, NameTheComputer, strInput1
Msg1 = "Preparing to run System Report on the"
Msg2 = "this will take a few minutes to complete."

Function ComputerGetName
TextBox0.focus()
MakeSleep
strInput1 = TextBox0.Value
If strInput1 = "" Then
NameTheComputer = CName
Text1.Innerhtml = Msg1 & " Local Computer<BR>" & V & NameTheComputer & ", " & Msg2
Act.Run(SD & "\Rest2.Vbs"),0,true
Text2.Innerhtml = "Processing the script"
BuildSystemReport
End If
If strInput1 <> "" Then
NameTheComputer = strInput1
Text1.Innerhtml = Msg1 & " Network Computer<BR>" & NameTheComputer & ", " & Msg2
Act.Run(SD & "\Rest2.Vbs"),0,true
Text2.Innerhtml = "Processing the script"
BuildSystemReport
End If
End Function

</Script>
<!-- =======================SCRIPT SEPARATOR ======================= -->
<script language="VBScript"><!--
Function BuildSystemReport
' // --> Wmi Object
Dim objWMIService
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & NameTheComputer & "\root\cimv2")

' // **************************************************
' // --> WMI Computer Class

Dim Computer, Comp, CompMBHta, CpuCount, ObjComp , ObjCompHta, Ram
Set Computer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
' // **************************************************
' // --> WMI Computer Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Computer Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each ObjComp in Computer
CpuCount = ObjComp.NumberOfProcessors
Ram = FormatNumber(ObjComp.TotalPhysicalMemory / MB,1)
Comp = Split(ObjComp.UserName,"\")

' // **************************************************
' // --> Computer information for the Hta

ObjCompHta = ("<TABLE Bgcolor="""" Style="""">" & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Computer Information</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Logon On Name</TD>" & Ln2 &_
HtaStyle2 & UCase(Comp(1))& "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Computer Name</TD>" & Ln2 &_
HtaStyle2 & UCase(Comp(0))& "</TD></TABLE>" & Ln2)

' // **************************************************
' // --> WMI Computer Class Bottom Text Message

Text2.Innerhtml = "Adding the Computer Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI OsInfo Class

Dim N1, OsInfo , objOs, objOsHta, ServicePack, WinDate
Set OsInfo = objWMIService.ExecQuery( "SELECT * FROM Win32_OperatingSystem",,48)
' // **************************************************
' // --> WMI Operating System Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Operating System Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each objOs in OsInfo
aDate = Left(objOs.InstallDate,8)
aDate1 = Left(aDate,4) : aDate2 = Right(aDate,4)
aDate2a = Left(aDate2,2) : aDate3 = Right(aDate2,2)
N1 = Split(objOs.Name,"|")
ServicePack = UCase(objOs.CSDVersion)
WinDate = aDate1 & "-" & aDate2a & "-" & aDate3
' // **************************************************
' // --> Operating System information for the Hta

objOsHta = (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Operating System Information</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "OS Name</TD>" & HtaStyle2 & UCase(N1(0)) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "OS Version</TD>" & HtaStyle2 & UCase(objOs.Version) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "OS Install Date</TD>" & HtaStyle2 & WinDate & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Next
'''' --> End the OsInfo Wmi Object
' // **************************************************
' // --> WMI Computer Class Bottom Text Message

Text2.Innerhtml = "Adding the Operating System Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> Collects the Security Updates and what Service Pack that are installed.

Dim KbInfo, KbInfoHta, objQuickFix, colQuickFixes, RptKB, RptHta, RP_1, RP_2
KbInfo = (TableTop & TdBig & Table1 & TdSmall & V &_
"<B>Service Pack Information</B></TD></TABLE>" & Table1 & HtaStyle1 & Ln2 &_
"Service Pack Installed</TD>" & HtaStyle2 & ServicePack & "</TD></TABLE>")
' // **************************************************
' // --> WMI Service Pack And Security Updates Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Service Pack And Security Updates Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

Set colQuickFixes = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering")
For Each objQuickFix in colQuickFixes
RP_1 = objQuickFix.Description
If InStr(RP_1,"Windows") Then
RP_2 = Replace(RP_1,"Security Update for Windows Media Player 10","Security Update For WMP10")
RptKB = RP_2
RptHta = RptHta & Ln2 & Table1 & HtaStyle1 & "Name  " & objQuickFix.HotFixID & "</TD>" & Ln2 & HtaStyle2 & RptKB & "</TD></TABLE>"
End If
Next
'''' --> End the Service Pack and Security Updates
' // **************************************************
' // --> WMI Service Pack And Security Updates Class Bottom Text Message

Text2.Innerhtml = "Adding the Service Pack And Security Updates Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> Service Pack and Security Update information for the Hta

KbInfo = KbInfo & Ln2 & (TableTop & TdBig & Ln2 &_
Table1 & TdSmall & "<B>Installed Security Updates Total = " & colQuickFixes.count & "</B></TD></TABLE>")

KbInfoHta = (KbInfo & Ln2 & RptHta & "</TD></TABLE>")

' // **************************************************
' // --> Mother Board information for the Hta
' // **************************************************
' // --> WMI Mother Board Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Mother Board Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

CompMBHta = CompMBHta & (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Mother Board Information</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Manufacturer</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjComp.Manufacturer) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Description</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjComp.Description) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Model</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjComp.Model) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Installed Ram</TD>" & Ln2 &_
HtaStyle2 & Ram & " MB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "SystemType</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjComp.SystemType) & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Next
'''' --> End the Computer Wmi Object
' // **************************************************
' // --> WMI Service Pack And Security Updates Class Bottom Text Message

Text2.Innerhtml = "Adding the Mother Board Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI Bios Class

Dim Bios, objBios , objBiosHta
Set Bios = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS",,48) '''' --> START THE WMI Bios Class
' // **************************************************
' // --> WMI Bios Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Bios Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each objBios in Bios
BDate = Left(objBios.ReleaseDate,8)
BDate1 = Left(BDate,4) : BDate2 = Right(BDate,4)
BDate2a = Left(BDate2,2) : BDate3 = Right(BDate2,2)
Dim BiosDate : BiosDate = BDate1 & "-" & BDate2a & "-" & BDate3

' // **************************************************
' // --> Bios information for the Hta

objBiosHta = (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Bios Information</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Bios Release Date</TD>" & HtaStyle2 & BiosDate & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Bios Made By</TD>" & HtaStyle2 & UCase(objBios.Manufacturer) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Bios Version</TD>" & HtaStyle2 & UCase(objBios.Version) & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Next
'''' --> End the Bios Wmi Object
' // **************************************************
' // --> WMI Bios Class Bottom Text Message

Text2.Innerhtml = "Adding the Bios Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI CpuInfo Class

Dim CpuInfo, objCPU , CpuInfoHta
Set CpuInfo = objWMIService.ExecQuery( "SELECT * FROM Win32_Processor",,48)
' // **************************************************
' // --> WMI CPU Class Top Text Message

Text1.Innerhtml = "Collecting the WMI CPU Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each objCPU in CpuInfo

' // **************************************************
' // --> Cpu information for the Hta

CpuInfoHta = (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>CPU Information</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Manufacturer</TD>" & V &_
HtaStyle2 & UCase(objCPU.Manufacturer) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Processor Name</TD>" & Ln2 &_
HtaStyle2 & UCase(objCPU.Name) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Number Of CPU`s</TD>" & Ln2 &_
HtaStyle2 & CpuCount & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Cpu Details</TD>" & Ln2 &_
HtaStyle2 & UCase(objCPU.Description) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Processor Speed</TD>" & Ln2 &_
HtaStyle2 & objCPU.MaxClockSpeed & " MHZ" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "L2 Cache Size</TD>" & Ln2 &_
HtaStyle2 & objCPU.L2CacheSize & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "L2 Cache Speed</TD>" & Ln2 &_
HtaStyle2 & objCPU.L2CacheSpeed & " MHZ" & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Next
'''' --> End the CpuInfo Wmi Object
' // **************************************************
' // --> WMI CPU Class Bottom Text Message

Text2.Innerhtml = "Adding the CPU Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> Original Script by RoqueSpear, re-edit by Gunsmokingman
' // --> WMI Installed Software Class

Dim InstallSW, objSW, SWcol, SWinfoHta, SWName, SWN,SWVer
Set SWcol = objWMIService.ExecQuery("Select * from Win32_Product",,48)

' // **************************************************
' // --> Label For Software

SWinfoHta = (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Installed Software</B></TD></TABLE>")
' // **************************************************
' // --> WMI Software Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Software Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each objSW in SWcol
SWName = Replace(objSW.Name,"HighMAT Extension to Microsoft Windows XP CD Writing Wizard","HighMAT CD Writing Wizard")
SWN = SWName
InstallSW = (InstallSW & Table1 & HtaStyle1 & "Installed Software</TD>" & Ln2 &_
HtaStyle2 & SWN & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Version</TD>" & Ln2 &_
HtaStyle2 & objSW.Version & "</TD></TABLE>" & Ln2)
Next
'''' --> End the Install Software Wmi Object
' // **************************************************
' // --> Installed Software for the Hta

SWinfoHta = SWinfoHta & InstallSW

' // **************************************************
' // --> WMI Software Class Bottom Text Message

Text2.Innerhtml = "Adding the Software Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI HDinfo Class

Dim HDinfo, HDId, HDS, ObjHD, HDinfoHta
Set HDinfo = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive",,48)
' // **************************************************
' // --> WMI Hard Drive Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Hard Drive Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each ObjHD In HDinfo
HDS = Left(ObjHD.Size / GB,5) : HDId = Right(ObjHD.DeviceID,14)

' // **************************************************
' // --> Hard drive information for the Hta

HDinfoHta = HDinfoHta & (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Hard Drive Information</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Hard Drive Model</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjHD.Model) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Device ID</TD>" & Ln2 &_
HtaStyle2 & UCase(HDId) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Hard Drive Size</TD>" & Ln2 &_
HtaStyle2 & HDS & " GB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Number Of Partitions</TD>" & Ln2 &_
HtaStyle2 & ObjHD.Partitions & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Next
'''' --> End the HDinfo Wmi Object
' // **************************************************
' // --> WMI Hard Drive Class Bottom Text Message

Text2.Innerhtml = "Adding the Hard Drive Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI Partition Class

Dim Large, ObjPart, Partition, PartitionHta, Pfs, Ps, Small, UsedSpace
Set Partition = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk where DriveType = 3")
' // **************************************************
' // --> WMI Partition Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Partition Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each ObjPart In Partition
Ps = Left(ObjPart.Size /GB,5) : Pfs = Left(ObjPart.FreeSpace / GB,5) : UsedSpace = Ps - Pfs
If UsedSpace < 1 Then

' // **************************************************
' // --> Partition information for the Hta if there is less then a gigabit of space used

Ps = Left(ObjPart.Size /MB,5): Pfs = Left(ObjPart.FreeSpace / MB ,5)
UsedSpace = Ps - Pfs : Small = Left(UsedSpace,5)
PartitionHta = PartitionHta & (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Partition Information Less then a Gigabit of Used Space</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Partition Letter</TD>" & Ln2 &_
HtaStyle2 & ObjPart.Name & "\" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Volume Name</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjPart.VolumeName) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Total Size</TD>" & Ln2 &_
HtaStyle2 & Ps & " MB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Free Space</TD>" & Ln2 &_
HtaStyle2 & Pfs & " MB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Used Space</TD>" & Ln2 &_
HtaStyle2 & Small & " MB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "File System</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjPart.FileSystem)& "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Else

' // **************************************************
' // --> Partition information for the Hta if there is more then a gigabit of space used

Large = Left(UsedSpace,5)
PartitionHta = PartitionHta & (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Partition Information More then a Gigabit of Used Space</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Partition Letter</TD>" & Ln2 &_
HtaStyle2 & ObjPart.Name & "\" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Volume Name</TD>" & V &_
HtaStyle2 & UCase(ObjPart.VolumeName) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Total Size</TD>" & Ln2 &_
HtaStyle2 & Ps & " GB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Free Space</TD>" & Ln2 &_
HtaStyle2 & Pfs & " GB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Used Space</TD>" & Ln2 &_
HtaStyle2 & Large & " GB" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "File System</TD>" & Ln2 &_
HtaStyle2 & UCase(ObjPart.FileSystem)& "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
End If
Next
'''' --> End the Partition Wmi Object
' // **************************************************
' // --> WMI Partition Class Bottom Text Message

Text2.Innerhtml = "Adding the Partition Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI Cd or Dvd Class
Dim CD_Col, CD_Obj, CDInfoHta
Set CD_Obj = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
' // **************************************************
' // --> WMI Cd or Dvd Class Top Text Message

Text1.Innerhtml = "Collecting the WMI Cd or Dvd Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

For Each CD_Col in CD_Obj
If CD_Col.MediaLoaded = True Then

' // **************************************************
' // --> A disk was in the CD or DVD drive information for the Hta

CDInfoHta = CDInfoHta & (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>CD Or DVD had a Disk In It</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Device ID</TD>" & Ln2 &_
HtaStyle2 & CD_Col.Id & "\" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Volume Name</TD>" & Ln2 &_
HtaStyle2 & UCase(CD_Col.VolumeName) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Name</TD>" & Ln2 &_
HtaStyle2 & UCase(CD_Col.Name) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Description</TD>" & Ln2 &_
HtaStyle2 & UCase(CD_Col.Description) & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
Else

' // **************************************************
' // --> No disk in the CD or DVD drive information for the Hta

CDInfoHta = CDInfoHta & (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>CD Or DVD had no Disk In It</B></TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Device ID</TD>" & Ln2 &_
HtaStyle2 & CD_Col.Id & "\" & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Name</TD>" & Ln2 &_
HtaStyle2 & UCase(CD_Col.Name) & "</TD></TABLE>" & Ln2 &_
Table1 & HtaStyle1 & "Description</TD>" & Ln2 &_
HtaStyle2 & UCase(CD_Col.Description) & "</TD></TABLE>" & Ln2 &_
"</TD></TABLE>")
End If
Next
'''' --> End the Cd or Dvd Wmi Object
' // **************************************************
' // --> WMI Cd or Dvd Class Bottom Text Message

Text2.Innerhtml = "Adding the Cd or Dvd Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> WMI Usb Class

Dim ObjUsb, StrObj, StrUsb, USBdevice, UsbList, UsbName, UsbReport
Set ObjUsb = objWMIService.ExecQuery("Select * From Win32_USBControllerDevice")
' // **************************************************
' // --> WMI USB Class Top Text Message

Text1.Innerhtml = "Collecting the WMI USB Class Information"
Act.Run(SD & "\Rest2.Vbs"),0,true

UsbReport = (TableTop & TdBig & Table1 & TdSmall & Ln2 &_
"<B>Usb Report</B></TD></TABLE>" & Ln2)
For Each StrUsb in ObjUsb
UsbName = StrUsb.Dependent
UsbName = Replace(UsbName, Chr(34), "")
UsbList = Split(UsbName, "=")
UsbName = UsbList(1)
Set USBdevice = objWMIService.ExecQuery("Select * From Win32_PnPEntity Where DeviceID = '" & UsbName & "'")
For Each StrObj in USBdevice

' // **************************************************
' // --> USB information for the Hta

UsbReport = UsbReport & Table1 & HtaStyle1 & "Device Name</TD>" & Ln2 &_
HtaStyle2 & StrObj.Description & "</TD></TABLE>"
Next
Next
'''' --> End the Usb Wmi Object
' // **************************************************
' // --> WMI USB Class Bottom Text Message

Text2.Innerhtml = "Adding the USB Information preparing for the next WMI Class"
Act.Run(SD & "\Rest1.Vbs"),0,true

' // **************************************************
' // --> Start the Hta output

Dim MkHta : MkHta = SD & "\" & NameTheComputer & ".Hta"
Dim Ts : Set Ts = Fso.CreateTextFile(MkHta)
Dim BodyStyle, Button, ButtonClnDefrag, ButtonStyle, ScriptJS, StyleHta, TdStyle1
' // **************************************************
' // --> Build the HTA Top Text Message

Text1.Innerhtml = "Building the Computer Report For <BR>" & NameTheComputer
Act.Run(SD & "\Rest2.Vbs"),0,true

' // **************************************************
' // Body back ground for the Hta CSS Style

BodyStyle = "Body.Normal {font:10.75pt;font-family:Palatino-Linotype;color:#004040;background-color:#ed0926;filter:" & Ln2 &_
"progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#eeeeee',endColorStr='#d0d0d0');" & Ln2 &_
"padding-top:1;padding-bottom:1;Text-Align:Center;Valign:Top;} "

' // **************************************************
' // Button back ground for the Hta CSS Style

ButtonStyle = " .Button {font-family:Palatino-Linotype;font-size :8.75pt;font-weight:Bold-Italic;" & Ln2 &_
"line-height:110%;color:#000080;background-color:#6CA2E3;filter:progid:DXImageTransform.Microsoft.Gradient" & Ln2 &_
"(GradientType=0,StartColorStr='#c0bcb6',endColorStr='#ffffff');width:91;height:25;" & Ln2 &_
"padding-top:1;padding-bottom:1;padding-left:5;padding-right:5;margin-right:5;margin-left:5;}"

' // **************************************************
' // Td Style 1 back ground for the Hta CSS Style

TdStyle1 = "td.Style1{font:8.75pt;font-family:Palatino Linotype;color:#000080;filter:progid:DXImageTransform.Microsoft.Gradient" & Ln2 &_
"(GradientType=0,StartColorStr='#d0d0d0',EndColorStr='#eeeeee');padding-top:1;padding-bottom:1;Text-Align:Center;}"

' // **************************************************
' // --> Js script for the hta
<!--
ScriptJS = "<script language=javascript>" & Ln2 & _
"window.resizeTo (555,791), window.moveTo (250,75);" & Ln2 & _
"var V=('\\'), Hidden =(""0""), Normal = (""1""), Min = (""2""),Max = (""3"");" & Ln2 & _
"var Fso = new ActiveXObject(""Scripting.FileSystemObject"");" & Ln2 & _
"var Act = new ActiveXObject(""Wscript.Shell"");" & Ln2 & _
"var enumItems = new Enumerator(Fso.Drives);" & Ln2 & _
"function DeFragDrv(Drv)" & Ln2 & _
" { for (; !enumItems.atEnd(); enumItems.moveNext()) " & Ln2 & _
" { var objItem = enumItems.item(), Drv_L = objItem.DriveLetter;" & Ln2 & _
" if ( objItem.IsReady == true); if ( objItem.DriveType == 2)" & Ln2 & _
" { var HD_Report =""Did You Want To Defrag This Drive"" +'\n'+ "" Drive : "" +Drv_L+ "":"" +V " & Ln2 & _
" var DefragIt = confirm(HD_Report);" & Ln2 & _
" if ( DefragIt == true ){Act.Run(""Defrag "" +Drv_L+ "":"" +V+ "" -F"",Min,true);}}}}" & Ln2 & _
"function ClnMgr()" & Ln2 & _
" {Act.run (""cleanmgr /sagerun:99"",Normal , true);}" & Ln2 & _
"function DrvDeFrag(Drv)" & Ln2 & _
"{ for (; !enumItems.atEnd(); enumItems.moveNext())" & Ln2 & _
"{ var objItem = enumItems.item(), Drv_L = objItem.DriveLetter;" & Ln2 & _
" if ( objItem.IsReady == true); if ( objItem.DriveType == 2)" & Ln2 & _
"{Act.Run(""Defrag "" + objItem.DriveLetter + "":"" + V + "" -F"",Min,true);}}}" & Ln2 & _
"function ClnMgrDefrag(Drv)" & Ln2 & _
"{Act.run (""cleanmgr /sagerun:99"",Normal , true),DrvDeFrag(), alert(""Completed Clean Manager and Defrag"");}" & Ln2 & _
"function DrvDeFrag(Drv)" & Ln2 & _
"{ for (; !enumItems.atEnd(); enumItems.moveNext())" & Ln2 & _
"{ var objItem = enumItems.item(), Drv_L = objItem.DriveLetter;" & Ln2 & _
" if ( objItem.IsReady == true); if ( objItem.DriveType == 2)" & Ln2 & _
"{Act.Run(""Defrag "" + objItem.DriveLetter + "":"" + V + "" -F"",Min,true);}}}" & Ln2 & _
"function ClnMgrDefrag(Drv)" & Ln2 & _
"{Act.run (""cleanmgr /sagerun:99"",Normal , true),DrvDeFrag(), alert(""Completed Clean Manager and Defrag"");}" & Ln2 & _
"</SCRIPT>"
-->
' // --> CSS Variables for the Hta

StyleHta = S_3 & Ln2 & "<style type=""text/css"">" & V &_
S_3 & BodyStyle & Ln2 & ButtonStyle & Ln2 & TdStyle1 & Ln2 &"</STYLE>"

' // **************************************************
' // --> Makes the Hta

Ts.WriteLine S_3 & StyleHta & Ln2 & ScriptJS
Ts.WriteLine S_3 & "<Body" & " Class=""Normal"">" & Ln2 &_
"<B>" & Ucase(Comp(0) & " Information")
Ts.WriteLine S_3 & ObjCompHta
Ts.WriteLine S_3 & objOsHta
Ts.WriteLine S_3 & KbInfoHta
Ts.WriteLine S_3 & SWinfoHta
Ts.WriteLine S_3 & CompMBHta
Ts.WriteLine S_3 & objBiosHta
Ts.WriteLine S_3 & CpuInfoHta
Ts.WriteLine S_3 & ButtonClnDefrag
Ts.WriteLine S_3 & HDinfoHta
Ts.WriteLine S_3 & PartitionHta
Ts.WriteLine S_3 & CDInfoHta
Ts.WriteLine S_3 & UsbReport
Ts.Close
' // **************************************************
' // --> Build the HTA Bottom Text Message

Text2.Innerhtml = "Completed building the Computer Report For <BR>" & NameTheComputer
Act.Run(SD & "\Rest2.Vbs"),0,true

' // **************************************************
' // --> Replaces The Original Message
Text1.Innerhtml = "To run System Report on the Network Computer type in the Network Computer Name, then press Enter"
Text2.Innerhtml = "To run System Report on the Local Computer leave the Inputbox blank and press enter."

' // **************************************************
' // --> Runs the Hta and then ask to delete the Hta or keep the Hta

Act.Run(MkHta),1,True
Dim ZZ1 : ZZ1 = Act.Popup("Did you want to keep this file?" & V & MkHta &_
V & "Yes to Keep" & S_5 & "No to delete" & V & "If you do not make a select in" &_
V & "One minute then it saves the file", 61,"Keep Or Delete", 4 + 48)
' // **************************************************
' // --> Delete the HTA file
If ZZ1 = 7 Then Fso.DeleteFile(MkHta) End If

Exit Function
End Function
'''' ****************************************************************************************************
*******
--></Script>
<!-- =======================SCRIPT SEPARATOR ======================= -->
<center><body CLASS="Normal" Scroll="No">
</v:shapetype><v:shape id="Run001png" type="#_x0000_t75" style='width:69.5pt;height:21.5pt'>
<v:imagedata src="Run001.png" o:title="Winamps Media Player"/></v:shape>
<!-- =======================SCRIPT SEPARATOR ======================= -->
<Table><Td Class="Style1" Width="400"><Table><Td Class="Style1" Width="400" Height="48">
<Span ID="Text1"> 
To run System Report on the Network Computer type in the Network Computer Name, then press Enter</Span></Td></Table>
</Td></Table>
<Table><Td Width="400">
<!-- Enter Button -->
<input type="button" language="vbscript" Class="Button" Value="Enter" OnClick="ComputerGetName">
<!-- Text Box -->
 <input type="text" language="vbscript" Size="40" name="textbox0"> 
<!-- Exit Button -->
<input type="button" language="vbscript" Class="Button" Value="Close" OnClick="ExitHta"></Td></Table>
<!-- =======================SCRIPT SEPARATOR ======================= -->
<Table><Td Class="Style1" Width="400" Height="48">
<Span ID="Text2"> 
To run System Report on the Local Computer leave the Inputbox blank and press enter.</Span></Td></Table>
<!-- =======================SCRIPT SEPARATOR ======================= -->
</Center></table></body>

Edited by gunsmokingman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...