1 Reply Latest reply on Jan 23, 2018 2:06 PM by kduffy

    How to Add-PlValue to multiple tags for multiple time stamps using an input file in powersscript

    DivyaGowda

      Hi All,

       

      Am trying to add a value to number of tags using an input file.

      Currently am using below script for adding values for few tags.

       

      $conn = Connect-PIDataArchive -PIDataArchiveMachineName 'Servername'

      $pt = Add-PIValue -PointName sinusoid,sinusoid -Time '20-jan-2018 02:15:00','20-jan-2018 02:18:30' -Value 100,101 -WriteMode Append -Connection $conn

       

      Is it possible to add-PIValues using input file.

      Can anyone help me in this.

       

      Regards,

      Divya

        • Re: How to Add-PlValue to multiple tags for multiple time stamps using an input file in powersscript
          kduffy

          Hi Divya,

           

          The reading of a text file wouldn't be handled by any of the PI cmdlets, that would be handled by other Powershell cmdlets which would then pass the values and timestamps to the Add-PIValue cmdlet.

           

          For example, if you have a csv file as your input, you could use the Import-CSV cmdlet to read the file into a variable.

           

          Are you already familiar with Powershell in general? Specifically for this case, the pipeline operation would most likely be of use. If you're not already familiar with this style of Powershell scripting, one thing you could do instead is use the PI UFL Interface; it's designed to read text files and write their values to PI tags, and it includes a wizard so you don't have to write any of the code yourself.

           

          Kelsey