Giter Site home page Giter Site logo

readpipochannels's Introduction

readPiPoChannels

This powershell script reads all the channels in PI system and reads the XML of the channel configuration. Then writes the connection parameters of the channel to an excel file.

This will be helpful to generate documentation for all the channels available in the system.

After cloning this repository create a Properties.json file in the root directory of this repository.

Sample properties json looks like

{
    "pi_system_url" : "https://host:port/CommunicationChannelService/HTTPBasicAuth",
    "file_name" : "C:\\PIPOChannels-Test.xlsx",
    "download_channel_xml" : true
}

pi_system_url - Used for web-service connection

file_name - Used for file download path

download-channel_xml - Checks if channel XML files download is required. If true then downloads the files under Channels folder in the repo. Channels folder is added to .gitignore to avoid committing sensitive information.

Login credentials for CommunicationChannelService

A pop-up will be displayed asking for PI system credentials. These credentials will be used to access CommunicationChannelService

Enter PI System credentials

readpipochannels's People

Contributors

srinu3366 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

suhail-slh

readpipochannels's Issues

Unable to run the script

On PI 7.5 SP13 , I am getting below error - The login screen comes however, it doesn't run after that and below are the errors from powershell console.

PS C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master> C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetailsfromPI.ps1
ConvertFrom-Json : Invalid object passed in, ':' or '}' expected. (1): {
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:14 char:47

  • $properties = Get-Content .\Properties.json | ConvertFrom-Json
  •                                           ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
    • FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Reading Channel Names.....
Exception calling "Create" with "1" argument(s): "Invalid URI: The URI is empty."
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:5 char:5

  • $soapWebRequest = [System.Net.WebRequest]::Create($url)
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : UriFormatException

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:6 char:5

  • $soapWebRequest.Headers.Add("SOAPAction", "query")
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:7 char:5

  • $soapWebRequest.Headers.Add("Authorization", $authorization)
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

The property 'ContentType' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:8 char:5

  • $soapWebRequest.ContentType = "text/xml;charset=utf-8"
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'Accept' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:9 char:5

  • $soapWebRequest.Accept = "text/xml"
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'Method' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:10 char:5

  • $soapWebRequest.Method = "POST"
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'UseDefaultCredentials' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:11 char:5

  • $soapWebRequest.UseDefaultCredentials = $true
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:14 char:5

  • $requestStream = $soapWebRequest.GetRequestStream()
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Multiple ambiguous overloads found for "Save" and the argument count: "1".
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:15 char:5

  • $payload.Save($requestStream)
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodCountCouldNotFindBest

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:16 char:5

  • $requestStream.Close()
    
  • ~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:19 char:5

  • $resp = $soapWebRequest.GetResponse()
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:20 char:5

  • $responseStream = $resp.GetResponseStream()
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:22 char:5

  • $ReturnXml = [Xml] $soapReader.ReadToEnd()
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\functions\CallP
IChannelService.ps1:23 char:5

  • $responseStream.Close()
    
  • ~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:39 char:22

  • foreach ($channel in $ReturnXml.GetElementsByTagName('rn3:CommunicationChannelID ...
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Reading Channel XML configuration.....
Preparing Excel Output...
New-Object : Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed
due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:109 char:10

  • $excel = New-Object -ComObject excel.application
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
    • FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

The property 'visible' cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:110 char:1

  • $excel.visible = $false
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : PropertyNotFound
    
    

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:111 char:1

  • $workbook = $excel.Workbooks.Add()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:165 char:1

  • $workbook.SaveAs($outputpath)
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

You cannot call a method on a null-valued expression.
At C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master\GetChannelDetai
lsfromPI.ps1:166 char:1

  • $excel.Quit()
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    
    

PS C:\Users\localuser\Desktop\readPiPoChannels-master\readPiPoChannels-master\readPiPoChannels-master>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.