I'd like to be able to detect in a script whether a Windows Server 2008 installation has specific Windows features enabled, and install them if necessary. I do not simply want to use a "try to install the feature, even if it is already installed" approach, as I need to be able to perform additional steps at the install time.
For example, I know I can install the SNMP Service using the command line:
pkgmgr /iu:SNMP
What I don't know is how to check whether this package has been installed, ideally from VBScript/WMI, but from a command-line tool if necessary.
Ideally I also want to find a solution that does not involve Powershell, as I don't want to have to lower the powershell execution privileges that are set by default in a Windows 2008 install.