Page 1 of 2

Number of RDP session script not working

Posted: Mon May 23, 2016 12:14 pm
by bosecorp
Hi

I am trying to use this script, but dopesn't seem to work

https://exchange.nagios.org/directory/P ... fo/details


the script works in Windows 2008, WIndows 8, but it doesn't work in Windows 2012

and also the script doesn't give us the number of sessions for windows 2012.


Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

Z:\>c:

C:\>cd "Program Files"

C:\Program Files>cd "NSClient++"

C:\Program Files\NSClient++>cd scripts

C:\Program Files\NSClient++\scripts>cscript get_rdp_infovbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Input Error: There is no file extension in "C:\Program Files\NSClient++\scripts\
get_rdp_infovbs".

C:\Program Files\NSClient++\scripts>cscript get_rdp_info.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\NSClient++\scripts\get_rdp_info.vbs(370, 5) Microsoft VBScript
runtime error: Object doesn't support this property or method: 'InputBytes'


C:\Program Files\NSClient++\scripts>

Re: Number of RDP session script not working

Posted: Mon May 23, 2016 3:23 pm
by rkennedy
As this isn't a plugin we wrote, it's a bit difficult to troubleshoot.

Have you taken a look to see if any other plugins will work for you? I was able to find this one -
https://exchange.nagios.org/directory/P ... ns/details

Another option, could you look at your performance counters and see if you can monitor Terminal Services -> Active Sessions? You may be able to pull the active connections from there as well.

Re: Number of RDP session script not working

Posted: Mon May 23, 2016 6:35 pm
by Box293
I wrote this script a few years ago.
bosecorp wrote:the script works in Windows 2008, WIndows 8, but it doesn't work in Windows 2012
I had another user report this issue some time ago and they also had Windows 2012. I tried to help them however it seems as though the object the script is referencing no longer exists in the WMI class. I no longer work with Remote Desktop Servers so I have no interest in updating it.

If you weren't interested in the bytes information, you can comment out lines 398 - 430.

And replace line 494 with:

Code: Select all

FinalOutput = "Sessions {Active=" & TotalActive & " Idle=" & TotalIdle & " Disconnected=" & TotalDisconnected & "} |'Active Sessions'=" & TotalActive & " 'Idle Sessions'=" & TotalIdle & " 'Disconnected Sessions'=" & TotalDisconnected & " [get_rdp_info]"
I think that'll work.

Also, if your operating system is something other than english ... then I would give up as the sessions stuff isn't going to work either.

Re: Number of RDP session script not working

Posted: Tue May 24, 2016 4:04 pm
by bosecorp
that eliminated the errors,


but still doesn't give me the session count which is what I really want

Re: Number of RDP session script not working

Posted: Tue May 24, 2016 4:10 pm
by rkennedy
rkennedy wrote: Another option, could you look at your performance counters and see if you can monitor Terminal Services -> Active Sessions? You may be able to pull the active connections from there as well.
Are you able to see the active # of connections through the performance counters?

Re: Number of RDP session script not working

Posted: Tue May 24, 2016 4:13 pm
by bosecorp
Yes, I can.

what changes would need to be made to the script

Re: Number of RDP session script not working

Posted: Tue May 24, 2016 4:43 pm
by Box293
The script uses this command to get the connection details:

Code: Select all

qwinsta
What is the output of that command in a dos window?

Re: Number of RDP session script not working

Posted: Wed May 25, 2016 8:53 pm
by bosecorp
The commands shows the active sessions

Re: Number of RDP session script not working

Posted: Thu May 26, 2016 4:13 pm
by rkennedy
We didn't write the plugin for the Windows RDP sessions, so it's hard to say why it's not working.

If you can pull the information from performance counters as you mentioned, it may be easier to go that route.

Re: Number of RDP session script not working

Posted: Thu May 26, 2016 5:16 pm
by Box293
Performance counter is probably going to be easier.

These guides should help:

https://support.nagios.com/kb/category.php?id=19