espo89

Using PI Powershell Extensions to modify tag security settings

Discussion created by espo89 on Mar 28, 2012
Latest reply on Apr 7, 2012 by espo89

I've been playing with the Powershell extensions from OSI and have been able to do a number of things at a server level, for example creating new security groups in PI and mapping them to AD objects.   Really useful.

 

One of the things that I'm now trying to do is to manipulate the attributes of a list of PI points and I'm getting stuck.   I have a situation where I have a group of points based on a search criteria that I would like to modify the security settings on (add a group, remove a group, change access, etc.).   I'm able to retrive an list of PI points and attributes of those points, but I can't seem to modify an attribute and have it "stick" in the server.  In addition I'm not sure how to manipulate the security attributes on these points (seems to be returning a list of some PIACL object that I'm not familiar with). 

 

Here's the bases of my code:

 
$ServerName = "na-rk-2wygzn"
$PointSearch = "test*"

# Get the local host PI server
$srv = Get-PIServer $ServerName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue

if ($srv ) {

     #Get the point list from the search results
     $points = Get-PIPoint -Name $PointSearch -Attributes "*" -PIServer $srv
     foreach ($p in $points) {
     
          # Now modify the security settings on each of these tags
          # ???????
     
     }
}

else {
     Write-Host "Unable to connect to PI Server $ServerName"
}

 I'm hoping someone has an idea on how to replace the ?????? with some useful code.

 

Thanks

Outcomes