Welcome to MSDN Blogs Sign in | Join | Help

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
http://www.microsoft.com/info/cpyright.htm

Published Tuesday, October 16, 2007 7:04 PM by Boris Yanushpolsky
Filed under:

Attachment(s): SpecifyRunAsAccountForRunAsProfile.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Techy News Blog » Specifying a run as account for a run as profile

# re: Specifying a run as account for a run as profile

Wednesday, October 17, 2007 9:51 AM by JesseH

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

# re: Specifying a run as account for a run as profile

Thursday, October 18, 2007 6:28 AM by zied

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 ciao

Zied

# re: Specifying a run as account for a run as profile

Friday, November 02, 2007 4:10 PM by Stephen Baron

I changed AuthenticationName in the criteria to DisplayName and the script seems to work now

# re: Specifying a run as account for a run as profile

Friday, November 09, 2007 6:11 AM by Zied

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

# A Great place for SCOM scripts

Sunday, July 13, 2008 7:11 AM by Dario IT Solutions Blog

Check out Boris Yanushpolsky's blog ( http://blogs.msdn.com/boris_yanushpolsky ). Boris is an SCOM

# re: Specifying a run as account for a run as profile

Friday, February 06, 2009 7:54 PM by Samir Dangol

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?

# re: Specifying a run as account for a run as profile

Friday, February 06, 2009 8:04 PM by Boris Yanushpolsky

A runas account can only be associated with a health service.

# re: Specifying a run as account for a run as profile

Wednesday, February 11, 2009 6:09 PM by Samir Dangol

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???

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker