WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Performance Monitoring and WinBatch


Keywords:
performance monitor monitoring counter index tListProc AppExist WinExeName AppWaitClose cWndByWndSpec cWndByWndName SendKey SendKeysTo SendMenusto TerminateApp IntControl 56 213 215 239 271 263

WinBatch Functions affected by Performance Monitoring and Counter Issues

The problem is mostly likely a cause of the inabilty of Winbatch to access 'performance monitoring' on this *particular* machine.

If its only happening on one machine you might look into whether or not performance monitoring utilities could potentially get involved. Some of them seem to have bugs that clobber these functions.

Check if you can run the performance monitor 'perfmon.exe' on this machine? Right-click and choose 'Add Counters', in the 'Performance Object' dropdown list choose 'Process'. Do you see a list of process in the the 'Instance' list? If not that indicates Performance counters are probably disabled on this machine.


Exctrlst Tool

You could try installing and running the 'exctrlst' utility (Extensible Performance Counter List). This tool provides information about the performance counter DLLs that have been installed on a computer running Microsoft Windows. The tool lists the services and applications that provide performance information by using the Windows registry. When monitored using the Performance console provided in Windows, the data provided by these performance counters can be useful for optimizing and troubleshooting.

This GUI tool lists all services and applications that provide registry-based performance counters on local and remote Windows 2000, Windows XP Professional, and Windows Server 2003 systems. It displays the names and locations of the dynamic link libraries (DLLs) that support performance counters, indicates disabled counters, and lets you enable and disable the performance counters for a service.

Unlike most performance tools, which load performance counters in order to collect data, Exctrlst displays information directly from the Performance subkeys in the registry (HKLM\SYSTEM\CurrentControlSet\Services\ServiceName\Performance). As a result, Exctrlst lists all registered performance DLLs, even those that do not load or operate properly.

Performance counter developers can use this tool to find the DLLs, basic functions, and indexes of performance counters provided by a service. Administrators can use this tool to determine which services have installed performance counters on the system and to identify counters that are disabled or do not load properly.

Exctrlst displays the following information about performance counters:

System Requirements
http://technet.microsoft.com/en-us/library/cc737958(WS.10).aspx


Performance Monitor Wizard

Brief Description
This wizard simplifies creating and managing performance monitor logs.

Overview
The Performance Monitor Wizard simplifies the process of gathering performance monitor logs. It configures the correct counters to collect, sample intervals and log file sizes. This wizard can create logs for troubleshooting operating system or Exchange server performance issues.

System Requirements
Supported Operating Systems: Windows 2000; Windows Server 2003; Windows XP

http://www.microsoft.com/downloads/details.aspx?FamilyID=31fccd98-c3a1-4644-9622-faa046d69214&DisplayLang=en


Other Performance Monitoring Tools

Perfmon

To see a graphic display of performance counter data, use System Monitor. To run System Monitor, at the command prompt or in the Run dialog box, type Perfmon.

Typeperf

To list the performance counters on a local or remote system from the command line, use Typeperf, a tool included in Windows XP Professional and Windows Server 2003. Typeperf lists only the counters that are enabled and load and operate properly. For more information about Typeperf, see "Typeperf" in Help for Windows Server 2003.


Disabled Performance Counters

You may recieve one of the above WIL function errors because the one performance counter used to retrieve processes are disabled. To fix it, you try removing the "Disable Performance Counters" entry from the following registry entry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance 
You may refer to the following two Knowledge Base articles to get more information about enabling and disabling performance monitors:

PRB: Performance Object Is Not Displayed in Performance Monitor http://support.microsoft.com/default.aspx?scid=kb;EN-US;q249138

INFO: Controlling the Disabling of Performance Monitor Extensions http://support.microsoft.com/default.aspx?scid=kb;en-us;Q248993


Eventlog Entries that might indicate Performance Monitoring issues

Open the event viewer:

Repeat search for the System log.


How to manually rebuild Performance Counter Library values

When you use the System Monitor tool, some counters may be missing or do not contain counter data. The base set of performance counter libraries may become corrupted and may need to be rebuilt along with any extensible counters. This behavior may occur if certain extensible counters corrupt the registry, or if some Windows Management Instrumentation (WMI)-based programs modify the registry.

Extensible counter information is stored in both of the following locations:

To rebuild the base performance counter libraries manually:

  1. Expand the Perfc009.dat file and the Perfh009.dat file. These files are located on the Windows installation CD-ROM. The compressed files are found at DriveLetter:\i386\perfc009.da_ and at DriveLetter:\i386\perfh009.da_. Replace the files that are in the %Systemroot%\System32 folder.

  2. Start Registry Editor, and then locate the following key in the registry:
    	HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Perflib 
    	

  3. In the registry, change the LastCounter value to 1846 (decimal), and change the LastHelp value to 1847 (decimal).

  4. Locate the following registry key to search for services that have a Performance subkey:
    	HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services 
    	

  5. Remove the following values from the Performance subkey (if they exist):
    • FirstCounter
    • FirstHelp
    • LastCounter
    • LastHelp
You can also use the Exctrlst.exe tool to locate the performance counter dynamic-link library files (DLLs) that are installed, and then access the registry to remove the DWORD values. You now have a workable performance registry that contains only system base counters.

After you have completed this procedure, you must re-add the extensible counters from the list of services. Before you do so, however, you must identify the .ini file that is used to load the counters:

  1. Open a command prompt window.

  2. At the command prompt, type cd %Systemroot%\System32, and then press ENTER.

  3. At the command prompt, type findstr drivername *.ini, and then press ENTER.

  4. Note the name of the .ini file for each drivername in the list.

  5. At the command prompt, type the following line, and then press ENTER:
    lodctr inifile
    
    where inifile is the name of the .ini file for the driver that you want to reload.

    For example, if you want to reload the ASP driver, the list that you noted in step 4 shows that Axperf.ini is the .ini file for the ASP driver (axperf.ini:drivername=ASP). Therefore, to reload the ASP driver, type lodctr axperf.ini at the command prompt, and then press ENTER.

  6. Repeat step 5 for each .ini file in the list.

  7. Restart your computer.
To rebuild all Performance counters including extensible and third party counters in Windows Server 2003, type the following commands at a command prompt. Press ENTER after each command.
cd \windows\system32
lodctr /R
Note /R is uppercase.
Windows Server 2003 rebuilds all the counters because it reads all the .ini files in the C:\Windows\inf\009 folder for the English operating system.

Note If you are running a Cluster or Datacenter product, you must fail over the node to refresh the counter list after doing the preceding steps for both base counters and extensible counters.

Note On systems that are running applications that add their own performance counters, such as Microsoft Exchange or SQL Server, the .ini file that is used to load the performance counter may not be located in %Systemroot%\System32. These .ini files can usually be found under the applications folder structure.

Note If you receive an error message about the performance library when you use the preceding steps, you may have to unload and reload the IIS performance dynamic link libraries (DLLs). For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base Q267831 Event ID 2003 Warning message logged when loading performance counters


Remote Performance Monitoring and Security

If you are collecting data using the registry, monitoring a remote computer requires the use of the Remote Registry Service. If the service stops due to failure, the system restarts it automatically only once. Therefore, if the service stops more than once, you must restart the service manually on the second and any subsequent failures. To change this default behavior, modify the properties for Remote Registry Service. You can access service properties using Services under Services and Applications in Computer Management or under Administrative Tools. Also check the application and system logs in Event Viewer for events that might explain why the service stopped.

In addition, remote data collection requires access to certain registry subkeys and system files. Users need a minimum of Read access to the Winreg subkey in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers to provide remote access to the registry for the purpose of collecting data on remote systems. By default, members of the Administrators group have Full Control access and members of the Backup Operators group have Read access. Users also need Read access to the registry subkey that stores counter names and descriptions used by System Monitor. This subkey is

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\LanguageID,
where LanguageID is the numeric code for the spoken language for the operating system installation. (For the English language, the subkey is Perflib\009.) By default, members of the Administrators and Creator Owners groups, and the System account, have Full Control access. Therefore, a local user on a server who isn't logged on as an administrator will not be able to see performance counters.

Users might also require Read access to the files that supply counter names and descriptions to the registry, Perfc*.dat and Perfh*.dat. (The asterisk is a wildcard character representing the specific language code; for English, these are Perfc009.dat and Perfh009.dat.) If these files reside on an NTFS file system volume, then, in order to have access to them, the access control lists (ACLs) on these files must specify that the user has such access. By default, members of the Administrators and Interactive groups have sufficient access.

The remote computer allows access only to user accounts that have permission to access it. In order to monitor remote computers, the Performance Logs and Alerts service must be started in an account that has permission to access the remote computers you are attempting to monitor. By default, the service is started under the local computer's system account, which generally has permission to access only services and resources on the local computer. To start this under a different account, start Computer Management, double-click Services and Applications, and then click Services. Click Performance Logs and Alerts, and update the properties under the Log On tab. To monitor using counter logs or alerts, you must also have permission to read the

HKEY_CURRENT_MACHINE\SYSTEM\CurrentControlSet\Services\SysmonLog\LogQueries 
In general, administrators have this access by default. In each case, attempting to use the tools without appropriate permissions will generate an error message.

If you are collecting data remotely by means of WMI, the user must be a member of the Administrators group.

In short to be able to view performance counters on a remote computer, you must have the following permissions on the remote computer that you want to monitor:


tListProc Error

Issue

Recieve error "213 Cannot Retrieve Counter Index" or "239 Unable to locate 'ID process' counter" when executing tListProc.

Resolution

Performance counters might be disabled on this machine. Check if the following registry key is defined.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\PerfProc\Performance["Disable Performance Counters"] 
Use the 'Exctrlst Tool' or 'Performance Monitor Wizard' to re-enable Performance Counters.

AppExist Incorrectly Returns False

Issue

AppExist returns @False when application is running.

Resolution

Performance counters might be disabled on this machine. Check if the following registry key is defined.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\PerfProc\Performance["Disable Performance Counters"] 
Use the 'Exctrlst Tool' or 'Performance Monitor Wizard' to re-enable Performance Counters.

Also, check the task manager for process names with trailing #'s. these numbers are PID values being shown in duplicate wherever the PID value is non-zero. Only the "Idle" pseudo-process has a zero PID, and its PID value is only shown a single time.

< process-name ≶[_< non-zero-PID ≶]| < PID ≶
It would appear that the process counter entry used by AppExist() & AppWaitClose() on your system has been altered in some way so as to cause it to report more information than just the process name. It's now including PID information. When you identify the proper registry key/value, you can compare it with one from a working system and then restore the value accordingly.

If you check out the following link, this may explain what is showing up with those process names: http://support.microsoft.com/kb/281884


WinExeName Returns Null or Blank String

Issue

WinExeName Returns Null or Blank String.

Resolution

Performance counters might be disabled on this machine. Check if the following registry key is defined.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\PerfProc\Performance["Disable Performance Counters"] 
Use the 'Exctrlst Tool' or 'Performance Monitor Wizard' to re-enable Performance Counters.


AppWaitClose Fails to Wait for Application to Close.

Issue

AppWaitClose Fails to Wait for Application to Close.

Resolution

Performance counters might be disabled on this machine. Check if the following registry key is defined.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\PerfProc\Performance["Disable Performance Counters"] 
Use the 'Exctrlst Tool' or 'Performance Monitor Wizard' to re-enable Performance Counters.

Also, check the task manager for process names with trailing #'s. these numbers are PID values being shown in duplicate wherever the PID value is non-zero. Only the "Idle" pseudo-process has a zero PID, and its PID value is only shown a single time.

< process-name ≶[_< non-zero-PID ≶]| < PID ≶
It would appear that the process counter entry used by AppExist() & AppWaitClose() on your system has been altered in some way so as to cause it to report more information than just the process name. It's now including PID information. When you identify the proper registry key/value, you can compare it with one from a working system and then restore the value accordingly.

If you check out the following link, this may explain what is showing up with those process names: http://support.microsoft.com/kb/281884


cWndByWndSpec Error 263

Issue

Recieve "263 cWndbyWndSpec Unable To Collect Windows Specification Information" error when executing cWndByWndSpec.

Resolution

Performance counters might be disabled on this machine.

Either:


cWndByWndSpec Error 271

Issue

On a Windows 2003 server, using remote desktop to log into and run a compiled Winbatch script and recieve error "271: System error. Unable to determine module names." when executing cWndByWndSpec.

Resolution

To be able to run the script the user needs to be added to not only the Remote Desktop group, but also the Performance Monitor Users group. (Found under Active Directory Users and Computers).


cWndByWndName Error 271

Issue

Recieve and error on a 64 bit platform when executing cWndByWndName.

Resolution

64 bit platforms require the user to be a member of the 'Performance Monitor Group' in order to execute the cWndByWnd functions. Control Panel | Administrative Tools | Computer Management | Local User Groups | Groups. Add the user to the Performance Monitor Group.


SendKey, SendKeysTo or SendMenusTo Issue

Issue

SendKeys or SendmenusTo are slow when sending to a DOS window.

Resolution

This is because these functions are not able to map the DOS window name because Performance Counters are disabled. Either:


TerminateApp and IntControl 56 Does Nothing and returns @FALSE

Issue

IntControl 56 or TerminateApp are not terminating an application and returning @FALSE.

Resolution

This is because these functions are not able to map the window name because Performance Counters are disabled.

Check if the following registry key is defined.

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\PerfProc\Performance["Disable Performance Counters"] 
Use the 'Exctrlst Tool' or 'Performance Monitor Wizard' to re-enable Performance Counters.
Article ID:   W16964
File Created: 2014:07:18:11:45:44
Last Updated: 2014:07:18:11:45:44