Set-ManagementServer
Set-ManagementServer
Syntax
Parameter Set: FromAgentManagedComputer Set-ManagementServer [-PrimaryManagementServer] <ManagementServer> [-AgentManagedComputer] <AgentManagedComputer[]> [[-FailoverServer] <ManagementServer[]> ] [ <CommonParameters>] Parameter Set: FromGatewayManagementServer Set-ManagementServer [-PrimaryManagementServer] <ManagementServer> [-GatewayManagementServer] <ManagementServer[]> [[-FailoverServer] <ManagementServer[]> ] [ <CommonParameters>]
Detailed Description
Sets the management server of an agent.
Parameters
-AgentManagedComputer<AgentManagedComputer[]>
Specifies the agent-managed computers for which to set the management server.
Aliases | none |
Required? | true |
Position? | 2 |
Default Value | none |
Accept Pipeline Input? | true (ByValue) |
Accept Wildcard Characters? | false |
-FailoverServer<ManagementServer[]>
Specifies the failover server or servers to set.
Aliases | none |
Required? | false |
Position? | 4 |
Default Value | none |
Accept Pipeline Input? | true (ByValue) |
Accept Wildcard Characters? | false |
-GatewayManagementServer<ManagementServer[]>
Specifies the gateway management server or servers to set.
Aliases | none |
Required? | true |
Position? | 3 |
Default Value | none |
Accept Pipeline Input? | true (ByValue) |
Accept Wildcard Characters? | false |
-PrimaryManagementServer<ManagementServer>
Specifies the primary management server or servers to set.
Aliases | none |
Required? | true |
Position? | 1 |
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
Notes
-
For more information, type "Get-Help Set-ManagementServer -detailed". For technical information, type "Get-Help Set-ManagementServer -full".
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
Examples
-------------- EXAMPLE 1 --------------
This command first uses the Get-Agent cmdlet to retrieve references to all agents. It stores them in the $agents variable. It then uses the Get-ManagementServer cmdlet to retrieve all management servers and passes the results to Where-Object to filter for the one named "fabrikam." The result is stored in the $mgmt_server variable. Last, Set-ManagementServer is used to set "fabrikam" as the management server for all of the agents stored in the $agents variable.
C:\PS>$agents = get-agent$mgmt_server = get-managementserver |where-object {$_.PrincipalName -eq "fabrikam"}set-managementserver -agentmanagedcomputer $agents `-primarymanagementserver $mgmt_server
