Is there any script to change the point and data security settings of all the pi tags in data archive?
Using PI Builder is an option which i do not want to use as it takes lot of time. I have around .6 million tags in system.
If you want all the tags to have the same security configuration. I ususally just use PICONFIG.
Simply change the security string by whatever you may need. As with any piconfig mass edit, make sure to test your script first on a subset of tags.
@modify datasecurity="piadmin: A(r,w) | piadmins: A(r,w) | PIWorld: A(r)",ptsecurity="piadmin: A(r,w) | piadmins: A(r,w) | PIWorld: A(r)"
If you have some variation in tag security, you could still use the same logic but do it in two steps:
@ostr tag, ptsecurity, datasecurity
Then modify the text file (you can make bulk edits if you want to add one identity for example), then save the changes in the same .txt or .csv file
@istr tag, ptsecurity, datasecurity
Would you prefer to do this via piconfig or PowerShell? I believe it ought to be possible with either.
I am thinking that testing for the existing user is probably easier in PowerShell, but maybe with some clever piconfig searching we can exclude certain tags.
EDIT: I'm not the fastest at writing scripts, so by the time I completed the script I could easily have finished the job (ten times) in PI Builder. The trick to speed up PI Builder is to only import the columns you need. If it's just the tag name and the two security fields it should go relatively quickly even for 600k tags.
Just to be clear, Gabriel's script will REPLACE the security strings on all of your tags. I was thinking you wanted to edit the existing strings (a rather more complex task). If you just want to replace them, his script is fast and easy. As he said, test first. Or, even better, backup first.
Can we do it for specific pointsource? like @select tag=* where pointsource = R?
Absolutely, the syntax would be as follow:
@select tag=*, pointsource=R
Just note, that it will take a significantly more time to execute as it has to load the pointsource, but it will definitely work! As always, with piconfig, try on a subset of tags first and with the list mode before the edit or delete mode.
Retrieving data ...