Set-SCOMRunAsProfile

Set-SCOMRunAsProfile

Adds Run As accounts to or removes them from a Run As profile.

Syntax

Parameter Set: Empty
Set-SCOMRunAsProfile [-Account] <SecureData[]> [-Profile] <ManagementPackSecureReference> [-Action] <RunAsProfileAccountsAction> [-PassThru] [ <CommonParameters>]

Parameter Set: FromGroup
Set-SCOMRunAsProfile [-Group] <MonitoringObject[]> [-Account] <SecureData[]> [-Profile] <ManagementPackSecureReference> [-Action] <RunAsProfileAccountsAction> [-PassThru] [ <CommonParameters>]

Parameter Set: FromInstance
Set-SCOMRunAsProfile [-Instance] <MonitoringObject[]> [-Account] <SecureData[]> [-Profile] <ManagementPackSecureReference> [-Action] <RunAsProfileAccountsAction> [-PassThru] [ <CommonParameters>]

Parameter Set: FromManagementPackClass
Set-SCOMRunAsProfile [-Class] <ManagementPackClass[]> [-Account] <SecureData[]> [-Profile] <ManagementPackSecureReference> [-Action] <RunAsProfileAccountsAction> [-PassThru] [ <CommonParameters>]

Detailed Description

The Set-SCOMRunAsProfile cmdlet adds Run As accounts to or removes Run As accounts from a Run As profile.

Parameters

-Account<SecureData[]>

Specifies an array of Microsoft.EnterpriseManagement.Security.SecureData objects that represent Run As accounts. To obtain a SecureData object, use the Get-SCOMRunAsAccount cmdlet.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Action<RunAsProfileAccountsAction>

Specifies the action to take to update the Run As profile. The acceptable values for this parameter are:

-- Add
-- Remove

Aliases

none

Required?

true

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Class<ManagementPackClass[]>

Specifies an array of ManagementPackClass objects that represent the classes that the Run As account can manage. Specify a variable that stores classes, or use a cmdlet such as Get-SCOMClass that gets classes.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Group<MonitoringObject[]>

Specifies an array of monitoring objects that represent the groups that the Run As account can manage. Specify a variable that stores groups, or use a cmdlet such as Get-SCOMGroup that gets groups.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Instance<MonitoringObject[]>

Specifies an array of monitoring objects that represent the class instances that the Run As account can manage. Specify a variable that stores class instances, or use a cmdlet such as Get-SCOMClassInstance that gets class instances. This parameter also accepts group objects. To obtain a group object, use the Get-SCOMGroup cmdlet.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Profile<ManagementPackSecureReference>

Specifies the Run As profile to update. Specify a variable that stores a Run As profile, or use a cmdlet such as Get-SCOMRunAsProfile that gets a profile.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Add a Run As account to a Run As profile by specifying an account name

This example adds a Run As account to a Run As profile by specifying an account name.

The first command gets the Run As profile that has the display name Privileged Monitoring Account and stores it in the $Profile variable.

The second command gets the Run As account named High Privileged Account and stores it in the $Account variable.

The third command adds the account stored in the $Account variable to the Run As profile stored in the $Profile variable and configures the Run As account. Because the command does not specify a class, group or object, it configures the Run As account to manage all targeted objects.

PS C:\> $Profile = Get-RunAsProfile -DisplayName "Privileged Monitoring Account"
PS C:\> $Account = Get-SCOMRunAsAccount -Name "High Privileged Account"
PS C:\> Set-SCOMRunAsProfile -Action "Add" -Profile $Profile -Account $Account

Example 2: Add a Run As account to a Run As profile by specifying a path

This example adds a Run As account to a Run As profile by specifying a path name.

The first command gets the Run As profile named SQL Server Monitoring Account and stores it in the $Profile variable.

The second command gets the Run As account named Contoso\SQLAuth and stores it in the $Account variable.

The third command gets the group named Contoso financial SQL Servers and stores it in the $Group variable.

The fourth command adds the account stored in the $Account variable to the Run As profile stored in the $Profile variable and configures the Run As account to manage the group stored in the $Group variable.

PS C:\> $Profile = Get-SCOMRunAsProfile -DisplayName "SQL Server Monitoring Account"
PS C:\> $Account = Get-SCOMrunAsAccount -Name "Contoso\SQLAuth"
PS C:\> $Group = Get-SCOMGroup -DisplayName "Contoso financial SQL Servers"
PS C:\> Set-SCOMRunAsProfile -Action "Add" -Profile $Profile -Account $Account -Group $Group

Example 3: Add a Run As account to a Run As profile by specifying an object

This example adds a Run As account to a Run As profile by specifying an account object.

The first command gets the Run As profile object that has the display name SQL Server Monitoring Account and stores the object in the $Profile variable.

The second command gets the Run As account object named Contoso\SQLAuth and stores the object in the $Account variable.

The third command gets the group object that has the display name Contoso financial SQL Servers and stores the object in the $Group variable.

The last command adds the account and group stored in $Account and $Group to the profile SQL Server Monitoring Account, which is stored in the $Profile variable.

PS C:\> $Profile = Get-SCOMRunAsProfile -DisplayName "SQL Server Monitoring Account"
PS C:\> $Account = Get-SCOMrunAsAccount -Name "Contoso\SQLAuth"
PS C:\> $Group = Get-SCOMGroup -DisplayName "Contoso financial SQL Servers"
PS C:\> Set-SCOMRunAsProfile -Action Add -Profile $Profile -Account $Account -Group $Group

Add-SCOMRunAsProfile

Get-SCOMRunAsProfile

Remove-SCOMRunAsProfile

Get-SCOMClass

Get-SCOMClassInstance

Get-SCOMGroup

Get-SCOMRunAsAccount

Get-SCOMProfile