Public/Set-SwAgentPollingEngine.ps1

Function Set-SwAgentPollingEngine {
    <#
        .SYNOPSIS
        Change polling engine of target node.
 
        .DESCRIPTION
        This function can chane polling engine of each node. simply define agent id of node and new polling engine id.
 
        Note: Agent Id of target machine is required, you can execute "Get-Agent" command to find Agent Id.
    #>

    [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='None')]
    Param (
        [Parameter(Mandatory = $true)]
        [SolarWinds.InformationService.Contract2.InfoServiceProxy]$InfoServiceProxy,

        [Parameter(Mandatory = $true)]
        [int]$AgentId,

        [Parameter(Mandatory = $true)]
        [int]$PollingEngineId
    )

    if($PSCmdlet.ShouldProcess( "Verbose Description !", "Set Resource " + "Caption")){
        Write-Verbose -Message "Sending command to server ... "
        Invoke-SwisVerb -SwisConnection $InfoServiceProxy -EntityName "Orion.AgentManagement.Agent" -Verb "AssignToEngine" -Arguments @($AgentId, $PollingEngineId)
    }
}