• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

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

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
jackbenson
Asked:
jackbenson
  • 3
  • 3
1 Solution
 
Joshua GrantomSenior EngineerCommented:
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
 
jackbensonAuthor Commented:
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
 
Joshua GrantomSenior EngineerCommented:
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
jackbensonAuthor Commented:
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
 
Joshua GrantomSenior EngineerCommented:
No problem Jack, sorry there wasn't a WMI answer ;/
0
 
jackbensonAuthor Commented:
thanks for trying
0

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now