snazy2000 / SnipeitPS

Powershell API Wrapper for Snipe-it
MIT License
181 stars 47 forks source link

Unable to Connect to SnipeItPS #280

Closed RussellLeVasseur closed 2 years ago

RussellLeVasseur commented 2 years ago

So I am in the beginning troubleshooting phase of this. Basically as of last night I am not unable to connect to SnipeIt via this module. The web works fine. I dove in to Invoke-SnipeItMethod and am now at this:

This error is throwing in Invoke-SnipeitMethod.ps1 at line 54. I tested with powershell 5 and powershell 7 (line 51). I get the same error.

New-Object : Cannot find an overload for "PSCredential" and the argument count: "2".
At line:54 char:28
+ ...  $Token =  (New-Object PSCredential "user",$SnipeitPSSession.apiKey). ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands. 
   NewObjectCommand

Powershell Version:

PS C:\windows\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      22000  832   

SnipeIT Version: image

I am seeing no errors in laravel logs for the API. Not sure if there is anywhere else i need to look?

I am currently building a function to just send basic requests to the API and will see if that works. I will publish updates below as I obtain findings.

RussellLeVasseur commented 2 years ago

Closing this because the issue was an SSL certificate issue.