次の方法で共有


Update-SCSMConnector

Update-SCSMConnector

Updates the properties of a Service Manager connector.

Syntax

Parameter Set: Default
Update-SCSMConnector [-Connector] <Connector[]> [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Update-SCSMConnector cmdlet updates the properties of a Service Manager connector. For example, you can set the Enable property to $False to disable the connector, or you can set it to $True to enable the connector. Use this cmdlet conjunction with the Get-SCSMConnector cmdlet. After Get-SCSmConnector retrieves the object, you can modify the properties of the object, and then pass it to the current cmdlet. This cmdlet updates the properties.

The schedule property is only available if you have applied Service Manager 2012 R2 Update Rollup 6 or later.

For each connector type, you can update the following properties:

Active Directory Connector

-- Description
-- Enable
-- Name
-- RunAsAccount
-- SelectedObjects
-- Schedule

Configuration Manager Connector

-- Collections
-- Description
-- Enable
-- Name
-- RunAsAccount
-- Schedule

Operations Manager Alert Connector

-- CloseAlert
-- Description
-- Enable
-- Name
-- ResolveIncident
-- Rules
-- RunAsAccount
-- Schedule
-- Template

Operations Manager CI Connector

-- Description
-- Enable
-- Name
-- OperationsManagerServer
-- RunAsAccount
-- Schedule

Parameters

-Connector<Connector[]>

Specifies an object that represents a Service Manager connector.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-PassThru

Indicates that this cmdlet returns the connector that it updates. You can pass this object to other cmdlets.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

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.

  • Microsoft.EnterpriseManagement.ServiceManager.Sdk.Connectors.Connector

    You can pipe a connector to the Connector parameter.

Outputs

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

  • None.

    This cmdlet does not generate any output.

Examples

Example 1: Update objects in an Active Directory connector

This example updates the selected objects of an Active Directory connector. The first command gets a Run As account, by using the Get-SCSMRunAsAccount cmdlet, and then stores it in the $RunAsAccount variable.

The second command gets a connector by using the Get-SCSMConnector cmdlet, and then stores it in the $ADConnector variable.

The third command assigns a value to the Select property of $ADConnector.

The final command gets all connectors, and then passes those that use the $RunAsAccount as the Run As account to the current cmdlet. That cmdlet updates the connectors.

PS C:\> $RunAsAccount = Get-SCSMRunAsAccount -RunAsProfileName "NewProfile"
PS C:\> $ADConnector = Get-SCSMConnector -Name "WOODGROVE Active Directory"
PS C:\> $ADConnector.Select = "(&(objectCategory=computer)(name=*fulle*))"
PS C:\> Get-SCSMConnector | ForEach-Object { $_.RunAsAccount = $RunAsAccount } | Update-SCSMConnector

Example 2: Update the Run As account for connectors

The first command gets the Run As account that has the profile name NewProfile, and then stores the result in the $RunAsAccount variable.

The second command updates all connectors that have the Run As account of $RunAsAccount.

PS C:\> $RunAsAccount = Get-SCSMRunAsAccount -RunAsProfileName "NewProfile"
PS C:\> Get-SCSMConnector | ForEach-Object { $_.RunAsAccount = $RunAsAccount } | Update-SCSMConnector

Example 3: Update an Operations Manager Alert connector

This example adds a new rule to an Operations Manager Alert connector. The first command gets a connector, and then stores it in the $AlertConnector variable.

The second command adds a rule to the rules property of $AlertConnector. The New-SCSMAlertRule cmdlet creates the rule. The command extends over several lines.

The final command updates the connector to the current value of $AlertConnector.

PS C:\> $AlertConnector = Get-SCSMConnector "Alert Connector"
PS C:\>$AlertConnector.rules += New-SCSMAlertRule @{
>> Name = "newRule"
>> Template = Get-SCSMObjectTemplate -Name ".*IncidentTemplate.*"
>> ManagementPack = Get-SCManagementPack "System.Library"
>>}
PS C:\>Update-SCSMConnector -Connector $AlertConnector 

Get-SCSMConnector

New-SCSMAlertRule

Remove-SCSMConnector

Start-SCSMConnector