ConnectPIDataArchive Class
- Last UpdatedDec 15, 2025
- 5 minute read
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
InternalCommand
Cmdlet
PSCmdlet
OSIsoft.PowerShellOSICmdletBase
OSIsoft.PowerShellConnectPIDataArchive
Namespace: OSIsoft.PowerShell
Assembly: OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 3.1.1.0 (3.1.1.466)
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
| Name | Description | |
|---|---|---|
| ConnectPIDataArchive |
Properties
| Name | Description | |
|---|---|---|
| AccessToken | Access token to use when connecting to a PI Data Archive. | |
| AuthenticationMethod | PI authentication method to use when connecting to a PI Data Archive. | |
| ClientCredential | Client id and secret to get access token to use when connecting to a PI Data Archive. | |
| 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) | |
| 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) | |
| 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. | |
| PIDataArchiveConnectionConfiguration | Connection configuration object retrieved from the Known Servers Table (KST). Run "Get-Help Get-PIDataArchiveConnectionConfiguration" for more details. | |
| 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). | |
| 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. | |
| Port | Port number to use when connecting to a PI Data Archive. Default is 5450. | |
| PromptForAccessToken | Browser popup to authorize getting access token to use when connecting to a PI Data Archive. | |
| 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.
Examples
$con = Connect-PIDataArchive -PIDataArchiveMachineName "PISRV1" -PromptForAccessTokenThis example connects to the PI Data Archive via machine name after the user authorizes it using the browser.
Examples
$credential = [PSCredential]::New('clientid', (ConvertTo-SecureString 'clientsecret' -AsPlainText -Force)); $con = Connect-PIDataArchive -PIDataArchiveMachineName "PISRV1" -ClientCredential $credential
This example connects to the PI Data Archive via machine name using a client id and secret.