AnsweredAssumed Answered

Not able to navigate into AF elements hierarchy with OSIsoft.Powershell module

Question asked by MaximeHT on Mar 21, 2017
Latest reply on Sep 28, 2017 by mtippett

With the code here below, I'm not able to navigate into AF elements.

I can just  obtain the root element.

Is there a good way to obtain another target element ?

 

 

# Try to load AF Element = "\\Cluster_AF\Configuration\OSIsoft\PI SQL"

# 1. the parent element = OSIsoft

$afdb = Get-AFDatabase Configuration -AFServer (Get-AFServer Cluster_AF)

$element = Get-AFElement -Name OSIsoft -AFDatabase $afdb

$element.Count

# we obtain 1 element --> OK

$element

 

# 2. the child element = "PI SQL"

#$element2 = Get-AFElement -Name "PI SQL" -AFDatabase $afdb

$element2 = Get-AFElement -AFElement $element -Name "PI SQL" -AFDatabase $afdb

# -AFElement $element generate InvalidArgument exception !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

$element2.Count

$element2

 

# with the full name

$element3 = Get-AFElement -Name "\\Cluster_AF\Configuration\OSIsoft\PI SQL" -AFDatabase $afdb

# no exception

$element3.Count

# Count returns 0

$element3

Outcomes