Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<HTA:APPLICATION ID="A1" ICON="" APPLICATIONNAME="Test-HTA" sysMenu="no" navigable="yes" scroll="no" border="none" showintaskbar="yes" singleinstance="yes" innerborder="no">
<title>Test-HTA</title>
</head><body>
<script type="text/javascript">
function computername()
{
var wshShell = new ActiveXObject("WScript.Shell")
var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
return sComputerName
}
</script><strong>Computer Name is: <script type="text/javascript"> document.write(computername());</script></strong>
</body>
</html>
Output:
0 thoughts on “HTA script to display computer name”
Thanks. This really helped me out in creating a first logon script/hta.