Add support for impersonation


petebran enquired about allowing credentials to be specified when querying the status of remote windows services on other domains.

This is a great feature idea and I believe impersonation should be supported across all operations.
I propose implementing impersonation using a keyword and making it part of the script language. Initially, I suggested using the keyword using-credentials to delimit the credentials from the request component, but on further thought, since specifying credentials could be a frequent activity, it makes sense to use the shorter keyword, as

This would be used like this:

windows-service-status "MyService", "remotemachineA" as "domainA\userA", "passwordA" must-equal "Running"

windows-service-status "MyService", "remotemachineB" as "domainB\userB", "passwordB" must-equal "Running"

windows-service-status "MyLocalService" must-equal "Running"

The inclusion of credentials would have to be optional so we don't inconvenience ServiceMon users that only monitor resources on the same domain; also for backwards compatibility.
Closed Nov 21, 2012 at 5:01 PM by wheelies
Fixed in ServiceMon Release impersonation support is specific to an individual operation in the script and impersonation is optional, so existing scripts should work without needing any changes.This is how it is used:windows-service-status "Spooler", "server1" runas "domain\user", "password" must-equal "Running"If you don't want to use impersonation, you can omit the credentials and the currently logged in Windows user is used as previously:windows-service-status "Spooler", "server1" must-equal "Running"