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

PI Powershell

SetAFDatabase Class

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

Sets an AF Database

The Set-AFDatabase cmdlet will set a preexisting AF Database on an AF Server.

Inheritance Hierarchy

SystemObject
  InternalCommand
    Cmdlet
      PSCmdlet
        OSIsoft.PowerShellOSICmdletBase
          OSIsoft.PowerShellSetAFDatabase

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

Syntax

[CmdletAttribute("Set", "AFDatabase", SupportsShouldProcess = true)]
public class SetAFDatabase : OSICmdletBase
<CmdletAttribute("Set", "AFDatabase", SupportsShouldProcess := true)>
Public Class SetAFDatabase
	Inherits OSICmdletBase

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

The SetAFDatabase type exposes the following members.

Constructors

  NameDescription
Public method
SetAFDatabase

Properties

  NameDescription
Public property
AFDatabase

AFDatabase object representing the AF Database to set. Can be obtained with Get-AFDatabase.

Run "Get-Help Get-AFDatabase -Examples" for more information and sample usage.

Public property
Default

Set the AF Database to be the default database for the associated AF Server

Public property
DefaultPIServerName

Default PI Server for the Database

Public property
Description

Description of the AF Database

Public property
NewName

New name of the AF Database

Public property
PassThru

Returns objects that were changed. By default, this cmdlet does not generate any output

Examples

Set-AFDatabase -NewName MyAFDB_Renamed -Description "New Description for AF Database" -DefaultPIServerName "DEFPISERV" -AFDatabase $afDB

Where:

$afDB = Get-AFDatabase MyAFDB -AFServer (Get-AFServer -Name "PIAF1")

This example will rename the AF Database "MyAFDB" to "MyAFDB_Renamed" and also set the description to "New Description for AF Database" along with default PI Server "-DefaultPIServerName "DEFPISERV"

Examples

Set-AFDatabase -Default -AFDatabase (Get-AFDatabase -Name MyAFDB -AFServer (Get-AFServer -Default))

This example will set the AF Database "MyAFDB" as the default database on the default AF Server in one line.

See Also

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