When using Performance Monitor sensors to graph details of RDP sessions the sensors will go into alarm when the RDP session is disconnected.
As an example the counter '\Terminal Services Session(RDP-Tcp 6)\Total Compressed Bytes' will be available when the RDP server assigns a user to session 6 and return 'No data to return. (Performance Counter error 0x800007D5)' when the user disconnects.
Short of writing a loopback to use the API to auto-acknowledge the sensor, is there any way to recognise the specific error of an and handle it gracefully? This is not actually an error, just Windows advising that there is no data available, so it should be handled as a null (or zero) value.