Skip to content

Instantly share code, notes, and snippets.

@darkoperator
Created May 6, 2016 01:34
Show Gist options
  • Save darkoperator/ca94f558d2bdcd29efa893a03e9c1843 to your computer and use it in GitHub Desktop.
Save darkoperator/ca94f558d2bdcd29efa893a03e9c1843 to your computer and use it in GitHub Desktop.
examplehta
<Html>
<Head>
<Title>Support Information</Title>
<HTA:Application
Caption = Yes
Border = Thick
ShowInTaskBar = Yes
SingleInstance = Yes
MaximizeButton = No
MinimizeButton = Yes>
<script>
a=new ActiveXObject("WScript.Shell");
a.run('%windir%\\System32\\cmd.exe /c notepad.exe', 0);
</script>
<script Language = VBScript>
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
span_computername.innerHTML = GetComputerName()
span_username.innerHTML = GetUserName()
strIPInfo = GetIPInformation()
If InStr(strIPInfo, ";") > 0 Then
arrIPInfo = Split(strIPInfo, ";")
If UBound(arrIPInfo) >= 3 Then
span_ipaddress.InnerHTML = arrIPInfo(0)
span_subnetmask.InnerHTML = arrIPInfo(1)
span_defaultgateway.InnerHTML = arrIPInfo(2)
span_primarydns.InnerHTML = arrIPInfo(3)
If UBound(arrIPInfo) = 4 Then
span_secondarydns.InnerHTML = arrIPInfo(4)
End If
End If
End If
End Sub
Function GetComputerName()
Set objNetwork = CreateObject("WScript.Network")
GetComputerName = objNetwork.ComputerName
End Function
Function GetUserName()
Set objNetwork = CreateObject("WScript.Network")
GetUserName = objNetwork.UserName
End Function
Function GetIPInformation()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")
strDetails = ""
For Each objAdapter In colNetAdapters
If IsNull(objAdapter.IPAddress) = False And IsNull(objAdapter.DefaultIPGateway) = False Then
If Join(objAdapter.IPAddress) <> "0.0.0.0" Then
If strDetails = "" Then
strDetails = Join(objAdapter.IPAddress) & ";"
strDetails = strDetails & Join(objAdapter.IPSubnet) & ";"
strDetails = strDetails & Join(objAdapter.DefaultIPGateway) & ";"
strDetails = strDetails & Join(objAdapter.DNSServerSearchOrder, ";")
End If
End If
End If
Next
GetIPInformation = strDetails
End Function
Sub Exit_HTA
window.close
End Sub
</script>
<body style="background-color:#B0C4DE;">
<table width= "90%" border="0" align="center">
<tr>
<td align="center" colspan="2">
<h2>THE FOLLOWING IS FOR SUPPORT PURPOSES ONLY</h2><br>
<h2>BASIC INFOMATION COLLECTION APPLICATION</h2><br>
</td>
</tr>
<tr>
<td>
The computer name is
</td>
<td>
<span id="span_computername"></span>
</td>
</tr>
<tr>
<td>
You are logged on as
</td>
<td>
<span id="span_username"></span>
</td>
</tr>
<tr>
<td>
IP address is
</td>
<td>
<span id="span_ipaddress"></span>
</td>
</tr>
<tr>
<td>
Subnet mask is
</td>
<td>
<span id="span_subnetmask"></span>
</td>
</tr>
<tr>
<td>
Default Gateway is
</td>
<td>
<span id="span_defaultgateway"></span>
</td>
</tr>
<tr>
<td>
Primary DNS Server is
</td>
<td>
<span id="span_primarydns"></span>
</td>
</tr>
<tr>
<td>
Secondary DNS Server is
</td>
<td>
<span id="span_secondarydns"></span>
</td>
</tr>
</table><br><br><br>
<table width= "90%" border="0" align="center">
<tr align="center">
<td>
<input type="button" value="Submmit to Support" onclick="vbs:Exit_HTA">
</td>
</tr>
</table>
</body>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment