locked
Debug Add-InsightsCapability PowerShell command using WinDbg RRS feed

  • Question

  • Is it possible to step inside a PS command and get more information on the error messages.

    For example when I run the following command in three ways I sort of get three different error messages but none of them actually point to the error causing character:
    Way 1:
    Add-InsightsCapability -Name "Syt" -Library "C:\RdtCapability.dll" -Confirm:$false
    The error message I get is
    Add-InsightsCapability : System Insights failed to register one or more of data sources for capability 'Syt'. At line:1 char:1
    Way 2:
    Debug-Process -Name "Add-InsightsCapability -Name "Syt" -Library "C:\RdtCapability.dll" -Confirm:$false"
    Debug-Process : A positional parameter cannot be found that accepts argument 'Syt -Library C:\RdtCapability.dll -Confirm:False'.
    At line:1 char:1
    Way 3:
    > Add-InsightsCapability
    cmdlet Add-InsightsCapability at command pipeline position 1
    Supply values for the following parameters:
    Name: "Syt"
    Library: "C:\RdtCapability.dll"
    Adding a capability:
    Adding capability '"Syt"'. Do you want to continue?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
    Add-InsightsCapability : Illegal characters in path.
    At line:1 char:1
    I was told if I run PS inside WinDbg then I might be able to step inside the Add-InsightsCapability() call and exactly locate the illegal character. In general if this is indeed possible then it will be a very useful procedure to know for any other PS command. 
    regards

    ananda


    Monday, June 29, 2020 4:35 AM

All replies

  • Without all of the correct information and the complete error message we cannot help you.

    Carefully read the following for instructions.


    \_(ツ)_/

    Monday, June 29, 2020 4:43 AM
  • My apologies I have corrected my original post so as to not to cause confusion. Basically given any PS command is it possible to run it inside WinDbg and get more information on the error reported. When I say inside WinDbg I mean, you open WinDbg and chose the option File --> Open Executable and chose PowerShell.exe, that will open a PS window and then we run the PS commands in that window. 

    thanks

    ananda

    Monday, June 29, 2020 5:10 AM
  • I would suggest that you are missing an update to the module, the Net Framework or the Insights subsystem.

    Running under debug will not tell you any more.

    What is "Syt" supposed to be?


    \_(ツ)_/

    Monday, June 29, 2020 5:37 AM
  • Hi JRV,

    Thanks and I checked and both are uptodate. I have the latest .NET 3.5 as well as 4.0

    I also checked for Insight module by running 

    PS C:\Users\Administrator> Add-WindowsFeature System-Insights -IncludeManagementTools

    Success Restart Needed Exit Code      Feature Result                               
    ------- -------------- ---------      --------------                               
    True    No             NoChangeNeeded {}   

    So I had Googled and someone suggested running a Powershell under WinDbg will help get more insight to the error messages of Insight. So you say that is of no use :(. 

    Syt is just some random name. It can be anything right? It can be xyz or abcd. That is what I gathered form the usage. Am I wrong? Please correct me. Thanks again ... 

    -Name

    Specifies the name of the capability to be added.

     

                                            

    Monday, June 29, 2020 12:45 PM
  • You could try tracing file and registry calls with Process Monitor. 

    https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

    Monday, June 29, 2020 1:25 PM
  • latest .net is 4.7 or even 4.8 (not 4.0) and latest powershell 5.1

    could you please double check your versions, and update all needed components to really latest/greatest version


    The opinion expressed by me is not an official position of Microsoft

    Monday, June 29, 2020 1:27 PM
  • PS C:\Users\Administrator> Get-Host | Select-Object Version

    Version
    -------
    5.1.19577.1000

    and .NET is indeed 4.8.04084

    So that is all fine :(. Thanks for the suggestion though.

    Monday, June 29, 2020 1:56 PM
  • To check versions in PowerShell use "$PsVersionTable".

    PS C:\scripts> $PsVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      5.1.18362.752
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.18362.752
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    
    
    PS C:\scripts>
    



    \_(ツ)_/

    Monday, June 29, 2020 4:29 PM
  • I do have the latest ... Don't know what else to do ... :(

    PS C:\Users\Administrator> $PsVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      5.1.19577.1000
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.19577.1000
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1

    Monday, June 29, 2020 4:58 PM
  • I tried this and did not make much inroad tracing to the root of the error message. Thanks though, good to know one more tool. 
    Monday, June 29, 2020 4:58 PM
  • Then you need to validate the install and configuration.  Open the docs on how to install and use the admin console and be sure everything is working correctly.

    If you cannot find a cause then contact MS Support for help.  This subsystem is new and can likley get broken easily as OS updates are installed.


    \_(ツ)_/

    Monday, June 29, 2020 5:02 PM
  • Without running under debug or in a script what is the error message you get if you type the command into a console session?


    \_(ツ)_/

    Monday, June 29, 2020 5:04 PM
  • PS C:\Users\Administrator> Add-InsightsCapability -Name "Syt" -Library "C:\RdtCapability.dll" -Confirm:$false
    Add-InsightsCapability : System Insights failed to register one or more of data sources for capability 'Syt'.
    At line:1 char:1
    + Add-InsightsCapability -Name "Syt" -Library "C:\RdtCapability.dll" -C ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (Syt:String) [Add-InsightsCapability], Exception
        + FullyQualifiedErrorId : SystemInsightsError,Microsoft.SystemInsights.Management.PowerShell.AddInsightsCapabilityCommand

    Hi Jrv,

    Your first question "What is Syt?" put me to thinking. I double checked and still I feel the name can be any random thing not tied to anything. However the error message says 
    CategoryInfo          : InvalidData: (Syt:String) [Add-InsightsCapability], Exception

    That tells me Name parameter cannot be random. It gets authenticated somewhere and that is failing. 
    Before running Add-InsightsCapability I do edit the Registry as well as do a lodctr to upload the registers. None of them have any bearing on the "Name". The DLL I am loading is a sample from MSFT and as far as I can see is not tied to the name. Thanks for your patience. 

    regards

    ananda

    Monday, June 29, 2020 6:07 PM
  • Then I recommend that you contact the supplier of the module to find out how to install it and add it.  We cannot help with unknown modules.

    What I wanted to show you is that there is no need to run under debug.  The error contains all of the info returned.  Debug is only useful when you are testing and debugging a module that you have the source for or have developed.

    Remember Occam's Razor!


    \_(ツ)_/

    Monday, June 29, 2020 9:57 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,
    Yang Yang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, July 3, 2020 5:47 AM