Some co-workers are working on Powershell scripts for building out a PI server, including scripts for post-server install. Some of our post-server install tasks are:
- Creating archive files
- Renaming System digital state '?1' to 'Not Measured'
- Creating a few Float32 PI Points
- Assign the 'Not Measured' state at 1/1/2000 to those points
There are more tasks not mentioned for brevity. Basically they can accomplish the 1st three tasks easily. We've hit a brick wall with the last one. Here's my pain points with my limited knowledge with Add-PIValue:
- I can successfully create a digital state object for our 'Not Measured' state, but cannot assign it using Add-PIValue. Error: Add-PIValue : Unable to cast object of type 'OSIsoft.SMT.PIDigitalState' to type 'System.IConvertible'.
- If created in PI-SMT, I can read a PIValue using Get-PIValue but it will not let me assign it with Add-PIValue with same error as above.
- I cannot assign a text string of "Not Measured" to a Float32. Error message: Add-PIValue : Input string was not in correct format. I tried this with standard system state of "No Result" for same error.
- If I have a digital point, I can assign a value using Add-PIValue but only if the -Value is a text string or an integer code.
- I cannot assign a digital state object to a digital point using Add-PIValue.
- Lastly there is not -switch to control whether to replace duplicates or not. Hence it becomes very easy to write multiple values to the same event.
Any suggested work arounds with Powershell?