SharpSCCM icon indicating copy to clipboard operation
SharpSCCM copied to clipboard

[BUG] System.ArgumentException cmpivot

Open PaulDHaes opened this issue 1 year ago • 0 comments

Describe the bug CMPivot query for reading file content System.ArgumentException error. An unhandled exception of type System.ArgumentException occurred: Accessed JArray values with invalid key value: "Result" . Int32 array index expected. When executing

To Reproduce Steps to reproduce the behavior:

  1. Build latest content.
  2. Execute On GW1 . \SharpSCCM_merged.exe invoke admin-service -q "FileContent ('C: \Windows\system32\drivers\etc\hosts')" -i SMS00001 -mp 192.168.1.110 --no-banner -d 10
  3. Wait a few seconds and scroll down.
  4. See error

Expected behavior The full output that was seen by using the web browser was not displayed in the console. Instead, it throws an error. If you add the -j to display it in JSON it works but the format is a not good for reading the file content of a file.

Screenshots image

** SharpSCCM version** branch version ba2310353e09e2882e78718ef842e76810249e45 normally latest.

** Management point server specs (please complete the following information):**

  • OS: Windows Server 2019
  • ConfigMgr Version: 2111, Site version 5.0.9049.1000

Client specs (please complete the following information):

  • OS: Windows 10 GW-1
  • ConfigMgr Version 5.00.9049.1010

Additional context On line 203 in the SharpSCCM.AdminService file the code is like this. JArray results = (JArray)obj["value"]["Result"]; To fix the issue, it should be like this. JArray results = (JArray)obj["value"][0]["Result"];

result is like this image

PaulDHaes avatar Sep 12 '23 15:09 PaulDHaes