Specifying a run as account for a run as profile
Here is a sample script that demonstrates how to specify which RunAs account to use for a particular RunAs profile on a particular agent. The main reason I am blogging about this is that the code that needs to be written to do this is not straight forward, and one day you may need to automate this.
The script takes three parameters:
runAsProfileName - This is the name of the RunAs profile as it appears in the OpsMgr console
runAsAccountName - This is the name of the RunAs account as it appears in the OpsMgr Console. This is not the AD account name.
computerFQDN - This is the fully qualified name of the computer on which the RunAs account should be used by any rules/monitors/discoveries/tasks which are using the particular RunAs Profile.
In order to run the script you will need to do the following:
1 - Open the OpsMgr command shell
2 - Run the following: C:\SpecifyRunAsAccountForRunAsProfile.ps1 -runAsProfileName:'SQL Server Monitoring Account' -runAsAccountName:'SQL Monitoring Account' -computerFQDN:'srv1.contoso.com'
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included scripts are subject to the terms specified at
https://www.microsoft.com/info/cpyright.htm
SpecifyRunAsAccountForRunAsProfile.zip
Comments
- Anonymous
October 16, 2007
PingBack from http://www.artofbam.com/wordpress/?p=9268 - Anonymous
October 17, 2007
Boris, nice work here! Through consistent small efforts you're really building a nice archive of information and spreading the knowledge. Your efforts are appreciated!-Jess - Anonymous
October 17, 2007
hello,Thank you for script, it´s Nice...But, when i launch the command, get:"Health Service with the specified name was not found"...Why??Can you help me please to resolve this problem?!Thank you very much BORIS...and Good Job..Ciao ciaoZied - Anonymous
November 02, 2007
I changed AuthenticationName in the criteria to DisplayName and the script seems to work now - Anonymous
November 08, 2007
hello,Thanks for the Script...I have a question: This script is just for a computer (ComputerFQDN), and when i like to add a Group, or more than one machine! what can i do??Thank you very much...ciao ciao - Anonymous
July 12, 2008
Check out Boris Yanushpolsky's blog ( http://blogs.msdn.com/boris_yanushpolsky ). Boris is an SCOM - Anonymous
February 06, 2009
It only works between RunAs Account and HealthService Association. What if I want to add association like "Alert Notification Subscription Server" or "Notification Subscription Server" which are not HealthService? - Anonymous
February 06, 2009
A runas account can only be associated with a health service. - Anonymous
February 11, 2009
If we are using SCOM UI, then we can easily add any MonitoringClass other than health service to associate with runas account.From UI, I am adding "Alert Notification Subscription Server" class associated with my runas account to "Notification Account" runas profile. So, I want to automate this process. How can we acheive it from cmdlets???