Adding a computer to the Distribution list on a RunAs Account
-
Thursday, September 23, 2010 10:45 AM
Using System Center Operations Manager 2007 R2 SDK and C# I am trying to update a RunAs Account.
The account is configured in advance, but I need to add a computer to the accounts distribution list (More secure is selected). I have been checking the MonitoringSecureData class and related classes. But I cannot find any properties or methods that seem to be related to the distribution.
Does anyone know which perperty, method or class to use ?
I am not trying to update RunAs profile here. That part is working already. RunAs Account Distribution.
TIA,
Jan Nielsen
All Replies
-
Friday, September 24, 2010 3:48 AMModerator
Funny!
We're looking for the same thing at about the same time:
I'm hoping to wake up tomorrow morning and have something in PowerShell which you may be able to use as a guide for porting to C#...
-
Friday, September 24, 2010 11:52 AMModerator
Have a look here:
http://www.systemcentercentral.com/BlogDetails/tabid/143/IndexID/81040/Default.aspx
- Proposed As Answer by Marco ShawModerator Friday, September 24, 2010 11:52 AM
- Marked As Answer by Nicholas LiMicrosoft Contingent Staff, Moderator Tuesday, September 28, 2010 2:32 AM
- Unmarked As Answer by Jan Nielsen Wednesday, October 06, 2010 9:19 AM
- Unproposed As Answer by Jan Nielsen Wednesday, October 06, 2010 9:20 AM
-
Wednesday, October 06, 2010 9:18 AM
Hi Marco,
Thanks for replying, but as far as I can see the referenced script updates the runas PROFILE to reference another runas account. I cannot see it changes the runas account distribution list.
I believe Microsofts SDK documentation has such an example already.
Regards,
Jan -
Wednesday, October 06, 2010 8:10 PMModerator
Hi Marco,
Thanks for replying, but as far as I can see the referenced script updates the runas PROFILE to reference another runas account. I cannot see it changes the runas account distribution list.
I believe Microsofts SDK documentation has such an example already.
Regards,
Jan
Agreed. I'll do some more digging, but I can't promise anything at this point. -
Thursday, October 21, 2010 1:40 PM
I finally figured out how to do it. Actually it wasn't that difficult once I found out the right method is ApproveCredentialForDistribution.
Sample code without error handling:
public void SetRunasAccount(string strRunAsAccount)
{
MonitoringSecureData account = GetRunasAccount(strRunAsAccount);
List<MonitoringObject> list = new List<MonitoringObject>();
foreach (AgentManagedComputer agent in GetAgents())
{
list.Add(agent.HostedHealthService);
}
m_objMG.ApproveCredentialForDistribution((ISecuredData)account, list);
}- Proposed As Answer by Jonathan AlmquistModerator Thursday, October 21, 2010 7:32 PM
- Marked As Answer by Jonathan AlmquistModerator Friday, December 31, 2010 5:25 PM
-
Thursday, October 21, 2010 7:32 PMModeratorNice work, Jan. I'll have to see if there is some way we can port this over to PS.
HTH, Jonathan Almquist - MSFT -
Friday, October 22, 2010 1:07 AMModerator
Hi Jan,
Yes, good job... Now, would you mind sharing your GetRunasAccount function code?
-
Friday, December 31, 2010 9:51 AMModeratorHi. No activity for 30 days. Will mark as answer. Feel free to re-open. Thanks
Anders Bengtsson | Microsoft PFE | blog at http://www.contoso.se- Marked As Answer by .Anders BengtssonMicrosoft Employee, Moderator Friday, December 31, 2010 9:51 AM
- Unmarked As Answer by Jonathan AlmquistModerator Friday, December 31, 2010 5:25 PM
-
Saturday, March 05, 2011 8:58 PM
Hi All,
Just wanted to let you know I created a Console app for this. Will probably make a blogpost later and share the console app. Some info can be already found here:
Regards,
Stefan
Regards, Stefan Stranger Microsoft Services- Marked As Answer by Jonathan AlmquistModerator Saturday, August 06, 2011 4:45 AM
-
Saturday, August 06, 2011 4:44 AMModerator
Here are a couple examples.
Using group reference: http://blogs.technet.com/b/jonathanalmquist/archive/2011/08/05/solving-the-problem-of-automated-distributing-of-credentials-group-criteria.aspx
Using literal expression: http://blogs.technet.com/b/jonathanalmquist/archive/2011/08/05/solving-the-problem-of-automated-distribution-of-credentials-literal-expression.aspx
HTH, Jonathan Almquist - MSFT -
Saturday, August 06, 2011 4:44 AMModerator
Here are a couple examples using powershell.
Using group reference: http://blogs.technet.com/b/jonathanalmquist/archive/2011/08/05/solving-the-problem-of-automated-distributing-of-credentials-group-criteria.aspx
Using literal expression: http://blogs.technet.com/b/jonathanalmquist/archive/2011/08/05/solving-the-problem-of-automated-distribution-of-credentials-literal-expression.aspx
HTH, Jonathan Almquist - MSFT- Marked As Answer by Jonathan AlmquistModerator Saturday, August 06, 2011 4:44 AM

