Brandon

PropertySource - Installed Windows Server Features

Recommended Posts

Useful for inventory, auditing, and auto-grouping.

Displays the a list of all installed Windows Features separated by commas.

Example below.

auto.winfeatures [Active Directory Lightweight Directory Services, .NET Framework 3.5.1 Features, Telnet Client, Remote Server Administration Tools, .NET Framework 3.5.1, Role Administration Tools, AD LDS Snap-Ins and Command-Line Tools, AD DS and AD LDS Tools, Active Directory module for Windows PowerShell]

 

WMN9DN

  • Like 1
  • Upvote 2

Share this post


Link to post
Share on other sites
On 3/3/2017 at 6:12 PM, Brandon said:

Useful for inventory, auditing, and auto-grouping.

Displays the a list of all installed Windows Features separated by commas.

Example below.

auto.winfeatures [Active Directory Lightweight Directory Services, .NET Framework 3.5.1 Features, Telnet Client, Remote Server Administration Tools, .NET Framework 3.5.1, Role Administration Tools, AD LDS Snap-Ins and Command-Line Tools, AD DS and AD LDS Tools, Active Directory module for Windows PowerShell]

 

WMN9DN

 

Share this post


Link to post
Share on other sites

Brandon,

I have modified the code slightly to get rid of the annoying open and close brackets(my OCD kicked in hard).

groovy script:

hostname=hostProps.get("system.hostname")
my_query="Select NAME from Win32_serverfeature"
def session = WMI.open(hostname);
import com.santaba.agent.groovyapi.win32.WMI
def result = session.queryAll("CIMv2", my_query, 15);
def strResult = result.NAME.toString();
def finalOutput = strResult.replace("["," ").replace("]"," ");
println "WindowsFeatures=" + finalOutput

 

P.S. - this script is awesome!

  • Upvote 3

Share this post


Link to post
Share on other sites

Good job @Brandon

@mkerfoot OCD for brackets, but doesn't use a code block....

I couldn't resist.

hostname=hostProps.get("system.hostname")
my_query="Select NAME from Win32_serverfeature"
def session = WMI.open(hostname);
import com.santaba.agent.groovyapi.win32.WMI
def result = session.queryAll("CIMv2", my_query, 15);
def strResult = result.NAME.toString();
def finalOutput = strResult.replace("["," ").replace("]"," ");
println "WindowsFeatures=" + finalOutput

 

Share this post


Link to post
Share on other sites

Well, I had a few use cases come up for this, so I decided to take another crack at it.  I think this is going to work out better for us than my first version:

hostname=hostProps.get("system.hostname") 
my_query="Select Name, DisplayName, PathName from Win32_Service"
def session = WMI.open(hostname);
import com.santaba.agent.groovyapi.win32.WMI
def result = session.queryAll("CIMv2", my_query, 15);
def exclude = ['ALG', 'AppVClient', 'COMSysApp','diagnosticshub.standardcollector.service',
	'FontCache3.0.0.0', 'EFS', 'KeyIso', 'msiserver', 'MSDTC', 'Netlogon', 'NetTcpPortSharing', 
	'RpcLocator', 'RSoPProv', 'PerfHost', 'SamSs', 'SensorDataService', 'Spooler', 'sppsvc', 'TrustedInstaller', 
	'UI0Detect', 'UevAgentService', 'VaultSvc', 'vds', 'VSS', 'WdNisSvc', 'WinDefend', 'wmiApSrv', 
	'WRSVC', 'WSearch']

result.each(){
	if ((!(it.PATHNAME.toLowerCase() ==~ /c:\\windows\\system32\\svchost\.exe .*/)) &&
	(!(it.NAME in exclude)))  {
	    println "WinService." + it.NAME.replaceAll(' ', '') + "=" + it.DISPLAYNAME
	}
}

return 0;

Someone try this one and let me know if I missed anything obvious.  I tried to cut out all the noise so it would only spit out the services anyone really cares about.

Share this post


Link to post
Share on other sites

Awesome job Guy's, loved it, but i wanted to show pretty much all the stuff so i updated it limiting the exclude to only Netlogon, 

EMRLT9

Screen Shot

Love it.

Medi

Edited by Medi Esmail

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now