Solved

WMI query for computers that DO NOT have Remote Desktop Servers installed

Posted on 2014-10-13
6
286 Views
Last Modified: 2014-10-20
Hi,

I need a group policy to run on all servers that DO NOT have Remote Desktop Services installed.

I can easily find which servers that DO have Remote Desktop Services installed as follows:

select * from Win32_OperatingSystem  WHERE ProductType="2"  OR ProductType="3"
select * from Win32_ServerFeature WHERE ID = 18

(http://msdn.microsoft.com/en-us/library/cc280268(v=vs.85).aspx shows that ServerFeature ID 18 = Remote Desktop Services)

the problem I have is that if I change the query to: select * from Win32_ServerFeature WHERE ID != 18 - then this will return true if any other feature is installed and I do not get the desired result.

can anyone help?

many thanks

jack
0
Comment
Question by:jackbenson
  • 3
  • 3
6 Comments
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40377847
You can add a query that checks for the "TermService" service. All Remote Desktop Services requires it to run. This should filter out all servers with it installed.

SELECT * FROM Win32_Service WHERE Name != 'TermService'
0
 
LVL 1

Author Comment

by:jackbenson
ID: 40378432
Joshua

thanks for your reply.
 
on the server running RDS this query returned all the services that were not Terminal Services that was installed on the machine and therefore the Group Policy was applied to the machine

on the server that was not running RDS - but had the ability to remote desktop to it enabled - it also returned true.

jack
0
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 500 total points
ID: 40379716
I think your best bet would be to add all of the RDS servers into a security group and deny them read access to the group policy you do not want applied
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:jackbenson
ID: 40391482
thanks - I was worried that I would have to do that - means I need to remember to add servers to the group in future

thanks for your help

jack
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40391915
No problem Jack, sorry there wasn't a WMI answer ;/
0
 
LVL 1

Author Comment

by:jackbenson
ID: 40391922
thanks for trying
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What to do when Windows Update is not working correctly? What tools can I use to detect the cause of the malfunction problem? What does this numeric error code mean? These and other questions that you have been asking in the past are answered here (…
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question