AnsweredAssumed Answered

Powershell Tools (2015) and hashtables of point attributes

Question asked by kjillson on Jul 24, 2015
Latest reply on Jun 7, 2017 by 1CassaBD

This may be a really stupid question (hopefully), but I'm trying to do something with the new Powershell tools (part of SMT 2015) where I want to grab the point attributes of a tag, and use them to build new cloned tags (ultimately on a separate system).  I want to do some manipulation on the attributes, but whenever I try to, it doesn't recognize the keys in the hashtable/dictionary that I pulled out.

 

First I did: 

 

$cdt158 = Get-PIPoint -name cdt158 -connection $piserver -Attributes $attr

 

where $piserver is my pi server and $attr is an array of strings (two of them, "pointid" and "recno")

 

This looks fine:

 

PS C:\Windows\system32> $cdt158.Attributes

 

 

Key                                                                                                             Value

---                                                                                                             -----

pointid                                                                                                             3

recno                                                                                                               3

 

But when I do:

 

PS C:\Windows\system32> $cdt158.Attributes.pointid

 

it returns nothing, and then when I do

 

PS C:\Windows\system32> $cdt158.Attributes.ContainsKey("pointid")

False

 

It's like it's not even there.  Not sure if i'm doing something wrong (still fairly new to Powershell, so it may very well be a bug between the keyboard and the chair). 

 

Thanks for any help,

 

Kendell

Outcomes