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

PI Powershell

ConnectPIDataArchive Class

  • Last UpdatedDec 15, 2025
  • 5 minute read
ConnectPIDataArchive Class

Connect to a PI Data Archive

The Connect-PIDataArchive cmdlet allows a connection to be made to the specified PI Data Archive. The target PI Data Archive can be specified by machine name/IP/FQDN or via an entry in the local Known Servers Table (KST).

The connection object returned by this cmdlet is used frequently by other cmdlets to specify which PI Data Archive the cmdlet should target.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellConnectPIDataArchive

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

Syntax

[CmdletAttribute("Connect", "PIDataArchive", DefaultParameterSetName = "MachineName", 
	SupportsShouldProcess = true)]
public class ConnectPIDataArchive : OSICmdletBase
<CmdletAttribute("Connect", "PIDataArchive", DefaultParameterSetName := "MachineName", 
	SupportsShouldProcess := true)>
Public Class ConnectPIDataArchive
	Inherits OSICmdletBase

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

The ConnectPIDataArchive type exposes the following members.

Constructors

  NameDescription
Public method
ConnectPIDataArchive

Properties

  NameDescription
Public property
AuthenticationMethod

PI authentication method to use when connecting to a PI Data Archive. Valid options are:

"Windows" or "Trust"

Public property
OpenTimeout

Timeout for opening and establishing a connection to the PI Data Archive. Should be set with syntax "hh:mm:ss"

If not specified, the default global value from the PISDK configuration is used. (Typically 10 seconds)

Public property
OperationTimeout

Timeout used when communicating with the PI Data Archive. Should be set with syntax "hh:mm:ss"

If not specified, the default global value from the PISDK configuration is used. (Typically 60 seconds)

Public property
Password

Password for PI Username used when connecting to the PI Data Archive. Used in conjunction with PIUsername.

Note: Explicit Login has been superseded by connecting via Windows Integrated Security (WIS) or PI Trusts. It is strongly recommended to connect via these authentication methods instead of explicit login. See -AuthenticationMethod parameter for details on connecting via WIS or PI Trusts.

Public property
PIDataArchiveConnectionConfiguration

Connection configuration object retrieved from the Known Servers Table (KST). Run "Get-Help Get-PIDataArchiveConnectionConfiguration" for more details.

Public property
PIDataArchiveMachineName

Machine name of the PI Data Archive to connect to. This can be a machine name, IP address, or Fully Qualified Domain Name (FQDN).

Public property
PIUsername

PI Username to use when connecting to the PI Data Archive. Used in conjunction with Password.

Note: Explicit Login has been superseded by connecting via Windows Integrated Security (WIS) or PI Trusts. It is strongly recommended to connect via these authentication methods instead of explicit login. See -AuthenticationMethod parameter for details on connecting via WIS or PI Trusts.

Public property
Port

Port number to use when connecting to a PI Data Archive. Default is 5450.

Public property
WindowsCredential

Windows Credential to use when connecting to a PI Data Archive.

Examples

$con = Connect-PIDataArchive -PIDataArchiveMachineName "PISRV1"

Connect via PI Data Archive Name: This example will connect to a PI Data Archive via machine name "PISRV1". Note that PIDataArchiveMachineName can be a machine name, IP address, or Fully Qualified Domain Name (FQDN). The resulting PI Connection object will be stored in the variable $con.

Examples

Connect-PIDataArchive -PIDataArchiveConnectionConfiguration (Get-PIDataArchiveConnectionConfiguration -Name PISRV1)

Connect via Connection Configuration: This example connects to a PI Data Archive or PI Collective using a PIDataArchiveConnectionConfiguration object, which is returned by the Get-PIDataArchiveConnectionConfiguration cmdlet. This will honor connection settings in the Known Servers Table to make the connection. This returns a PI Data Archive connection object.

Examples

Get-PIDataArchiveConnectionConfiguration -Name PISRV1 | Connect-PIDataArchive

Connect via Connection Configuration: This example is the same as the previous example, except that the PIDataArchiveConnectionConfiguration object is first retrieved and then passed to Connect-PIDataArchive via the PowerShell pipeline.

Examples

$con = Connect-PIDataArchive -PIDataArchiveMachineName "PISRV1" -AuthenticationMethod Windows -OpenTimeout 00:20:00 -OperationTimeout 00:05:00

This example connects to the PI Data Archive via machine name, and overrides default parameters of OpenTimeout and OperationTimeout. The authentication method is forced as WIS. If connection via WIS fails, no other attempts via Trust or Explicit Login will be attempted even if allowed by the PISDK protocol order.

See Also

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