?
Solved

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

Posted on 2014-10-13
6
Medium Priority
?
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
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 …
Suggested Courses

752 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