Set-SCOMRunAsDistribution

Set-SCOMRunAsDistribution

Sets the distribution policy of a Run As account for Operations Manager.

Syntax

Parameter Set: LessSecure
Set-SCOMRunAsDistribution [-RunAsAccount] <SecureData> -LessSecure [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: MoreSecure
Set-SCOMRunAsDistribution [-RunAsAccount] <SecureData> -MoreSecure [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [-SecureDistribution <Object[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Security
Set-SCOMRunAsDistribution [-RunAsAccount] <SecureData> -Security <String> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-PassThru] [-SCSession <Connection[]> ] [-SecureDistribution <Object[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Set-SCOMRunAsDistribution cmdlet sets the distribution policy of a Run As account for System Center 2012 – Operations Manager. Distribution policies determine which computers receive a credential for a Run As account. By default, new accounts have the more secure distribution with no approved systems.

Parameters

-ComputerName<String[]>

Specifies an array of names of computers. The cmdlet establishes temporary connections with management groups for these computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type the computer name, localhost, or a dot (.).

The System Center Data Access service must be started on the computer. If you do not specify a computer, the cmdlet uses the computer for the current management group connection.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the user account under which the management group connection runs. Specify a PSCredential object, such as one that the Get-Credential cmdlet returns, for this parameter. For more information about credential objects, type Get-Help Get-Credential.

If you specify a computer in the ComputerName parameter, use an account that has access to that computer. The default is the current user.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LessSecure

Indicates that Operations Manager distributes the credential automatically to all managed computers.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MoreSecure

Indicates that Operations Manager distributes the credential only to systems that the SecureDistribution parameter specifies.

Aliases

none

Required?

true

Position?

named

Default Value

none

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsAccount<SecureData>

Specifies an array of SecureData objects that represent Run As accounts. To obtain a SecureData object, use the Get-SCOMRunAsAccount cmdlet. This account cannot be part of a Run As profile.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SCSession<Connection[]>

Specifies an array of Connection objects. To get Connection objects, use the Get-SCOMManagementGroupConnection cmdlet.

If this parameter is not specified, the cmdlet uses the active persistent connection to a management group. Use the SCSession parameter to specify a different persistent connection. You can create a temporary connection to a management group by using the ComputerName and Credential parameters. For more information, type Get-Help about_OpsMgr_Connections.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SecureDistribution<Object[]>

Specifies an array of objects that represent systems that the cmdlet authorizes for distribution.

This parameter list can contain only the following types of items:

-- Agents. Objects that the Get-SCOMAgent cmdlet returns. The cmdlet authorizes this account to the agent for distribution.
-- Management servers. Objects that the Get-SCOMManagementServer cmdlet returns. The cmdlet authorizes this account to the agent for distribution.
-- Pools. Objects that the Get-SCOMResourcePool cmdlet returns. The cmdlet authorizes this account to the agent for distribution.
-- Health service instances. Objects that the Get-SCOMClassInstance cmdlet returns and that have a managed type of HealthService. The cmdlet authorizes this health service to the agent for distribution.

Passing output from the Get-SCOMRunAsDistribution cmdlet as input to Set-SCOMRunAsDistribution by using the pipeline operator automatically populates this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Security<String>

Specifies the security level. The acceptable values for this parameter are:

-- MoreSecure
-- LessSecure

Passing output from the Get-SCOMRunAsDistribution cmdlet as input to Set-SCOMRunAsDistribution by using the pipeline operator automatically populates this parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

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: Specify a less secure distribution

This command sets the Contoso\LowPriv account for less secure distribution, so that Operations Manager distributes the credential automatically to all managed computers. The command uses the Get-SCOMRunAsAccount cmdlet to get the specified account and passes it to the Set-SCOMRunAsDistribution cmdlet by using the pipeline operator. The command specifies the LessSecure parameter.

PS C:\> Get-SCOMRunAsAccount -Name "Contoso\LowPriv" | Set-SCOMRunAsDistribution -LessSecure

Example 2: Specify a more secure distribution without approved systems

This command sets the Contoso\LowPriv account for more secure distribution, with no approved systems. The command uses the Get-SCOMRunAsAccount cmdlet to get the specified account and passes it to the Set-SCOMRunAsDistribution cmdlet by using the pipeline operator. The command specifies the MoreSecure parameter.

PS C:\> Get-SCOMRunAsAccount -Name "Contoso\LowPriv" | Set-SCOMRunAsDistribution -MoreSecure

Example 3: Specify a more secure distribution to a collection

This example sets the Contoso\LowPriv account for more secure distribution to a collection of pools, agents, and servers, so that only specified pools, agents, and servers get the distribution.

The first command gets the pools, agents, and servers to receive more secure distribution and stores them in the $Distribution variable .

The second command gets pools, agents, and servers that have less secure distribution and passes them to the Set-SCOMRunAsDistribution cmdlet by using the pipeline operator. That cmdlet assigns them more secure distribution.

PS C:\> $Distribution = (Get-SCOMAgent -Name "*.contoso.com") + (Get-SCOMManagementServer) + (Get-SCOMResourcePool -DisplayName "Contoso Monitoring Pool")
PS C:\> Get-SCOMRunAsAccount "Contoso\LowPriv" | Set-SCOMRunAsDistribution -MoreSecure -SecureDistribution $Distribution

Example 4: Specify less secure distribution for a new Run As account

This command creates a Run As account for Windows and approves it for distribution to all agents. The command uses the Add-SCOMRunAsAccount cmdlet to add the account NewAccount with the credential that the Get-Credential cmdlet creates. It then passes the result to the Set-SCOMRunAsDistribution cmdlet by using the pipeline operator.

PS C:\> Add-SCOMRunAsAccount -Windows -Name "NewAccount" -Credential (Get-Credential) | Set-SCOMRunAsDistribution -MoreSecure -SecureDistribution (Get-SCOMAgent) 

Example 5: Copy a more secure distribution policy to a different account

This example copies the secure distribution policy from the Contoso\Administrator account to the Contoso\Monitoring account.

The first command uses the Get-SCOMRunAsAccount cmdlet to get the Contoso\Monitoring account and stores it in the $MonitoringAcct variable.

The second command uses the Get-SCOMRunAsAccount cmdlet to get the Contoso\Administrator account and passes it to the Get-SCOMRunAsDistribution cmdlet by using the pipeline operator. The command passes the result to the Set-SCOMRunAsDistribution cmdlet to copy the result to the Contoso\Monitoring account.

PS C:\> $MonitoringAcct = Get-SCOMRunAsAccount "Contoso\Monitoring"
PS C:\> Get-SCOMRunAsAccount "Contoso\Administrator" | Get-SCOMRunAsDistribution | Set-SCOMRunAsDistribution -RunAsAccount $MonitoringAccount

Get-SCOMAgent

Get-SCOMClassInstance

Get-SCOMManagementGroupConnection

Get-SCOMManagementServer

Get-SCOMResourcePool

Get-SCOMRunAsAccount

Get-SCOMRunAsDistribution