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

PI Powershell

NewPIArchive Class

  • Last UpdatedDec 15, 2025
  • 4 minute read
NewPIArchive Class

Creates a new PI Archive

The New-PIArchive cmdlet creates a new PI Archive file and attempts to register it with a PI Data Archive server.

The connection parameter specifies which connection to a PI Data Archive to use.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellOSICmdletBaseWithConnection
            OSIsoft.PowerShellNewPIArchive

Namespace:  OSIsoft.PowerShell
Assembly:  OSIsoft.PowerShell (in OSIsoft.PowerShell.dll) Version: 3.1.1.0 (3.1.1.466)

Syntax

[CmdletAttribute("New", "PIArchive", SupportsShouldProcess = true, 
	DefaultParameterSetName = "NameOnly")]
public class NewPIArchive : OSICmdletBaseWithConnection
<CmdletAttribute("New", "PIArchive", SupportsShouldProcess := true, 
	DefaultParameterSetName := "NameOnly")>
Public Class NewPIArchive
	Inherits OSICmdletBaseWithConnection

Dim instance As NewPIArchive
[CmdletAttribute(L"New", L"PIArchive", SupportsShouldProcess = true, 
	DefaultParameterSetName = L"NameOnly")]
public ref class NewPIArchive : public OSICmdletBaseWithConnection
[<CmdletAttribute("New", "PIArchive", SupportsShouldProcess = true, 
	DefaultParameterSetName = "NameOnly")>]
type NewPIArchive =  
    class
        inherit OSICmdletBaseWithConnection
    end

The NewPIArchive type exposes the following members.

Constructors

  NameDescription
Public method
NewPIArchive

Properties

  NameDescription
Public property
ArchiveSet

Specifies the archive set of the archive file to create. This is only supported for PI Data Archive 2015 or later.

0 = Historical

1 = Future

Public property
Connection

Specifies which connection to a PI Data Archive to use

(Overrides OSICmdletBaseWithConnectionConnection.)
Public property
EndTime

The end time of the archive file to create

Public property
Name

The full path and name of the archive file to create

Public property
Size

The size (MB) of the archive file to create

Public property
StartTime

The start time of the archive file to create

Public property
UsePrimaryPath

If specifying only the PI Archive name to create, use this flag to create the PI Archive in the same directory as the current primary archive

Public property
WaitForRegistration

PowerShell will wait to process any further commands until the new archive is registered with the PI Data Archive

Public property
WaitForRegistrationTimeOut

The registration timeout for registering the created PI Archive

Example: "00:01:00" is a timeout of 1 minute

Examples

New-PIArchive -Name E:\PIArchives\piarch009.arc -Size 1024 -Connection $con

Where:

$con = Connect-PIDataArchive -PIDataArchiveMachineName "PISRV1"

Creates a new archive file at E:\PIArchives\piarch000.arc and attempts registration with the "PISRV1" PI Data Archive server. This archive has an undefined start time and end time.

Examples

New-PIArchive -Name "D:\Program Files\PI\arc\piarch008.arc" -StartTime "01-Jan-2016" -EndTime "01-Feb-2016" -Size 512 -ArchiveSet 0 -Connection $con

Where:

$con = Connect-PIDataArchive -PIDataArchiveMachineName "PISRV1"

Creates a new archive file for the month of Jan, 2016 with fixed size of 512 MB at "D:\Program Files\PI\arc\piarch008.arc" and attempts to registration with the "PISRV1" PI Data Archive server. Note that the path to the archive contains a space so the entire path must be enclosed in double quotes.

See Also

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