Performance Counter Check | Previous

Performance Counter Check Samples


JScript sample for Windows Script Host:


var bar = WScript.CreateObject("IISSample.PerfCheck.1");
var value;

value = bar.counter("\\Process(inetinfo)\\ID Process");
WScript.Echo(value);
WScript.DisconnectObject(bar);

JScript sample for an Active Server Pages (ASP) page:


<script language=JScript runat=server>
var bar = Server.CreateObject("IISSample.PerfCheck.1");
var value;

value = bar.counter("\\Process(inetinfo)\\Thread Count");
Response.Write(value);
Response.Write("<br>done<br>");
</script>

VBScript sample for an ASP page:


<script language=VBScript runat=server>
set bar = Server.CreateObject("IISSample.PerfCheck.1")

value = bar.counter("\Process(inetinfo)\ID Process")
Response.Write value 
Response.Write "<br<done<br>"

value = bar.counter("\Process(inetinfo)\Thread Count")
Response.Write value 
Response.Write "<br>done<br>"
</script>

note-icon

Note

It is important to consider security issues when accessing IIS-specific counters. When using this object from an ASP page, the page must use integrated Windows authentication so that the object is not running as IUSR_... or IWAM_... This authentication method limits those with access to the metabase to the counter information. The solution to this is to disable anonymous access to the resource by clearing the Allow Anonymous Access check box in the Directory Security tab for the resource's directory. This is not an issue for Windows counters, but rather for IIS-specific counters such as ASP counters, FTP counters, and Web Service counters.