KelvinTegelaar / AutotaskAPI

Autotask 2020.2 REST API PowerShell wrapper

Home Page:https://cyberdrain.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get-AutotaskAPIResource -Resource ContractBlocksChild -ID Does not work on server core

JacobErnst98 opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\AutoTaskAPI\1.2.1\Public\Get-AutotaskAPIResource.ps1:48 char:9
$ResourceURL.name = $ResourceURL.name.replace("/query","/{PAR ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: (:) [], RuntimeException
FullyQualifiedErrorId : InvokeMethodOnNull

To Reproduce
Steps to reproduce the behavior:

  1. cmdlet used including parameters
    Get-AutotaskAPIResource -Resource ContractBlocksChild -ID ######
  2. Input used
  3. further info
    Seems to only be broken on server Core
    Works on Windows 11 Desktop
  4. Error code
    At C:\Program Files\WindowsPowerShell\Modules\AutoTaskAPI\1.2.1\Public\Get-AutotaskAPIResource.ps1:48 char:9
    $ResourceURL.name = $ResourceURL.name.replace("/query","/{PAR ...
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo : InvalidOperation: (:) [], RuntimeException
    FullyQualifiedErrorId : InvokeMethodOnNull

Expected behavior
A clear and concise description of what you expected to happen.
Return child blocks
Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Server Core 2019
  • PowerShell version: V5.1
  • Version 1.2.1 from the PSGallery

Additional context
Add any other context about the problem here.

That's a weird one. Can you give me a full PSVersiontable to investigate?

Name                           Value
----                           -----
PSVersion                      5.1.17763.1007
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1007
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
OsName                                                  : Microsoft Windows Server 2019 Standard
OsType                                                  : WINNT
OsOperatingSystemSKU                                    : StandardServerEdition
OsVersion                                               : 10.0.17763

After the recent update to get the PSGallery version to match the GitHub version I am running into this issue because the {ParentID} is not being properly passed so it fails with a null value.

The issue I had open for not being able to create ticketnoteschild is still occurring and now I am having it happen with creating tickets themselves, which previously worked fine until the update.

The code for swapping the {ParentID} is stopping before it swaps it with the actual ID value.

link to the now closed issue I am referencing: #44

I am observing the same behaviour when I want to query Child items of other objects. Even the one from the readme example. Note that I am on Windows 11.

image