Set-SCOMRunAsProfile

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

Syntax

Set-SCOMRunAsProfile
   [-Account] <SecureData[]>
   [-Profile] <ManagementPackSecureReference>
   [-Action] <RunAsProfileAccountsAction>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SCOMRunAsProfile
   [-Class] <ManagementPackClass[]>
   [-Account] <SecureData[]>
   [-Profile] <ManagementPackSecureReference>
   [-Action] <RunAsProfileAccountsAction>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SCOMRunAsProfile
   [-Instance] <MonitoringObject[]>
   [-Account] <SecureData[]>
   [-Profile] <ManagementPackSecureReference>
   [-Action] <RunAsProfileAccountsAction>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SCOMRunAsProfile
   [-Group] <MonitoringObject[]>
   [-Account] <SecureData[]>
   [-Profile] <ManagementPackSecureReference>
   [-Action] <RunAsProfileAccountsAction>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

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

Examples

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

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

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.

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

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

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.

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

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

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.

Parameters

-Account

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

Type:SecureData[]
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Action

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

Type:RunAsProfileAccountsAction
Position:4
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Class

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.

Type:ManagementPackClass[]
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Group

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.

Type:MonitoringObject[]
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Instance

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.

Type:MonitoringObject[]
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Indicates that the cmdlet creates or modifies an object that a command can use in the pipeline. By default, this cmdlet does not generate any output.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

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.

Type:ManagementPackSecureReference
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False