SetAFDatabase Class
- Last UpdatedDec 15, 2025
- 3 minute read
Sets an AF Database
The Set-AFDatabase cmdlet will set a preexisting AF Database on an AF Server.
Inheritance Hierarchy
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
| Name | Description | |
|---|---|---|
| SetAFDatabase |
Properties
| Name | Description | |
|---|---|---|
| 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. | |
| Default | Set the AF Database to be the default database for the associated AF Server | |
| DefaultPIServerName | Default PI Server for the Database | |
| Description | Description of the AF Database | |
| NewName | New name of the AF Database | |
| 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.