locked
Remove extra information from Powershell Scripts RRS feed

  • Question

  • Hi All.

    I have some Ps script which runs Ps commands remotely on other systems using WinRM.

    For some reason the output of the code keeps coming with the following extras, is there a way for me to remove it.

    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     False    CmdletBindingAttribute                   System.Management.Automation.CmdletCommonMetadataAttribute


    Script.


    • Edited by MrFlinstone Tuesday, October 1, 2019 10:16 PM
    Sunday, September 29, 2019 9:55 PM

All replies

  • Without the code that produces this there is no way to answer. All Cmdlets return objects with many properties.

    Start by learning basic PowerShell and this will become clear.  You cannot learn PS by guessing and asking questions until ou fully understand the basics.

    Here is one place to start learning PowerShell: Getting Started with Microsoft PowerShell  


    \_(ツ)_/

    Sunday, September 29, 2019 10:02 PM
  • What is it that you expect to be returned. Have you asked the author of the script to help you with this?


    \_(ツ)_/

    Sunday, September 29, 2019 10:04 PM
  • The code posted is loaded with syntax errors and logic errors. You need to debug this or aske the author to fix it for you. We cannot debug this as it can only be run on your system.


    \_(ツ)_/

    Sunday, September 29, 2019 10:37 PM
  • The code posted is loaded with syntax errors and logic errors. You need to debug this or aske the author to fix it for you. We cannot debug this as it can only be run on your system.


    \_(ツ)_/

    Hi,

    I will look into the syntax/logic errors, I want the output of the script converted to jSon, what seems to be happening is that there is extra information being returned, and its this information that I want to suppress/remove.

    Is there a way to stop the script from outputting the below ?

    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     False    CmdletBindingAttribute                   System.Management.Automation.CmdletCommonMetadataAttribute

    Monday, September 30, 2019 7:14 AM
  • Any luck here.
    Monday, September 30, 2019 2:51 PM
  • Fix your script and you will see what is breaking. We cannot debug this for you.

    I would start by removing the functions and writing the scriptblocks as a single script and testing it locally until it works as needed,


    \_(ツ)_/

    Monday, September 30, 2019 5:08 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Thursday, October 3, 2019 1:50 AM