I created a powershell script to define AF Server connection with these commands Set-AFServer and Add-AFServer. I would like to add an alias to the AF Server. But, i dont know which command to use. Can someone help me? thank you.
I believe setting there is no cmdlet specific for the purpose of setting connection aliases. If you however only like to set a single alias, the following should work:
$Alias = "Alias"$Path = "Your-AF-Server-Hostname"Add-AFServer -Name $Alias -Path $Path
The important thing is that the specified path points to a valid AF Server host.
Loading AF SDK through reflection and using its methods in PowerShell gives you better options.
Your question draw the attention of the team developing the OSIsoft.PowerShell module and I was asked to share their response.
Unfortunately, there is no support for adding aliases right now native to OSIsoft.PowerShell. The suggestion I've made with my previous post is considered kind of a workaround.
By calling Add-AFServer multiple times, you can get 1 alias. However, if there is already an alias, then the subsequent call to Add-AFServer will actually not add it but replace the alias. This is a bug and a new work item was created to document this issue. We apologize for the inconvenience.
If you want OSIsoft.PowerShell natively supporting to maintain server aliases, please consider posting an enhancement request at UserVoice. It is more clear with other products where to create enhancement requests but because OSIsoft.PowerShell belongs to PI Server System Management, is suggest creating the enhancement request at https://feedback.osisoft.com/forums/555148-pi-server?category_id=181231
Retrieving data ...