[OpsMgr] Powershell: How to enumerate RunAs accounts associated with RunAs profile.

Posted: July 22, 2013 in SCOM 2012

We all know how to view RunAs accounts associated with RunAs profile being inside UI.
Like this. Administration->Profiles. VoilĂ .
RunAsProfile

Ho to do the same enumeration from PowerShell?

#connect to management group
$mg = new-object Microsoft.EnterpriseManagement.ManagementGroup("localhost")
#get 'Default Action Account' profile and assign its ID to variable
$RunAsProfileId = (Get-SCOMRunAsProfile -DisplayName 'Default Action Account').Id
# get Health Service array associated with the profile
$HSref=$mg.GetMonitoringSecureDataHealthServiceReferenceBySecureReferenceId($RunAsProfileId)
#enumerate accounts
$HSref | %{$_.GetMonitoringSecureData().Name}</code>
Advertisements
Comments
  1. Josh says:

    Hello, do you have an idea? If I use your script to get the RunAsAccounts from the RunAsProfiles, I only get Accounts where are set to less secure, I don’t get accounts which are set to more secure.

  2. Curtiss says:

    now how can I use powershell to determine which template-authored monitors are using a certain runas profile?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s