Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Powershell

ConnectAFServer Class

  • Last UpdatedDec 15, 2025
  • 3 minute read
ConnectAFServer Class

Connect to an AF Server

The Connect-AFServer cmdlet will connect to an AF Server in the local AF Servers list.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellConnectAFServer

Namespace:  OSIsoft.PowerShell
Assembly:  OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 2.2.3.0 (2.2.3.952)

Syntax

[CmdletAttribute("Connect", "AFServer", SupportsShouldProcess = true)]
public class ConnectAFServer : OSICmdletBase
<CmdletAttribute("Connect", "AFServer", SupportsShouldProcess := true)>
Public Class ConnectAFServer
	Inherits OSICmdletBase

Dim instance As ConnectAFServer
[CmdletAttribute(L"Connect", L"AFServer", SupportsShouldProcess = true)]
public ref class ConnectAFServer : public OSICmdletBase
[<CmdletAttribute("Connect", "AFServer", SupportsShouldProcess = true)>]
type ConnectAFServer =  
    class
        inherit OSICmdletBase
    end

The ConnectAFServer type exposes the following members.

Constructors

  NameDescription
Public method
ConnectAFServer

Properties

  NameDescription
Public property
AFConnectionPreference

Defines the connection preference when connecting to an AF Server which is in an HA Collective. If not specified, PreferPrimary is the default.

Public property
AFServer

AFServer object representing the AF Server to connect to

Public property
WindowsCredential

Windows credential to use when connecting to the AF Server

Examples

Connect-AFServer -AFServer (Get-AFServer -Default)

This example will connect to the default AF Server in the local AF Servers list.

Examples

Connect-AFServer -WindowsCredential (Get-Credential TestDomain\TestUser) -AFServer (Get-AFServer -Name PIAF1)

This example will connect to the AF Server "PIAF1" with the credentials TestDomain\TestUser. Upon running the command, the user will be prompted for the password of the TestDomain\TestUser account. If -WindowsCredential is not specified, then the credentials of the user running PowerShell will be used.

Examples

Connect-AFServer -AFConnectionPreference Any -AFServer (Get-AFServer -Default)

This example will connect to the default AF Server with the connection preference "Any" if it is an AF Collective.

See Also

TitleResults for “How to create a CRG?”Also Available in