Coder Social home page Coder Social logo

ninjaone's People

Contributors

aretokas avatar bironeaj avatar homotechsual avatar illumin8i avatar jesseconnr avatar marco-itsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ninjaone's Issues

Error retrieving Organisation Documents

New-NinjaOneError: C:\Program Files\WindowsPowerShell\Modules\NinjaOne\1.3.0\Public\Get\Organisation\Get-NinjaOneOrganisationDocuments.ps1:37
Line |
37 | New-NinjaOneError -ErrorRecord $_
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The NinjaOne API said FAILURE: NullPointerException. The API returned the following HTTP error response: 500 Internal Server Error

Get-NinjaOneAlerts missing data

In v1.6.4 of this module, Get-NinjaOneAlerts is not returning what it should be.

It retuns a bunch of this:

message
-------
@{code=agent_customfields_matched; params=}
@{code=agent_cond_eventlog; params=}
@{code=agent_cond_script_result; params=}
@{code=agent_win_cond_disk_free_le; params=}

debug output shows that New-NinjaOneGETRequest receiving the right data, but only returning the 'data' property.

DEBUG: Response object: [{"uid":"435adb3f-d7cf-46bd-ae09-a88b8160f841","deviceId":1511,"message":"Custom Fields condition was matched: 'Deploy Outlook Signature'","createTime":1668617439.000000000,"updateTime":1668617439.000000000,"sourceConfigUid":"85a4276f-d7d8-47bb-a185-81fa84258972","sourceName":"","subject":"","data":{"message":{"code":"agent_customfields_matched","params":{"conditionName":"Deploy Outlook Signature"}}}}, ...

~~~~~~~~~~~~~~~~~~~~~

DEBUG: NinjaOne request returned:
uid             : 435adb3f-d7cf-46bd-ae09-a88b8160f841
deviceId        : 1511
message         : Custom Fields condition was matched: 'Deploy Outlook Signature'
createTime      : 1668617439
updateTime      : 1668617439
sourceConfigUid : 85a4276f-d7d8-47bb-a185-81fa84258972
sourceName      :
subject         :
data            : @{message=}


DEBUG: Returning 'data' property.
DEBUG: Result type is System.Object[]

I think it needs to return raw instead? Not quite sure. It was working in 1.2.x versions of the module.

Unable to Connect

I'm receiving the following error when executing connect-ninjaone.
The NinjaOne API returned an error but did not provide a result code or error message. The API
| returned the following HTTP error response:

This my RedirectUri in my Ninja Console:
https://Localhost:9090/*

I have attempted the configuration on two different computers with the same result.

Any help would be greatly appreciated.

Thanks,
Tammi

Unable to connect

Hello,

I think I followed all the steps from the ReadMe, but I still get an error when running the Connect-NinjaRMM CMDLet:

PS C:\Users\username> Connect-NinjaRMM @ConnectionParameters

New-NinjaRMMError: C:\Users\username\OneDrive - company\Dokumente\PowerShell\Modules\NinjaRMM\0.1.0\Public\Connect-NinjaRMM.ps1:132
Line |
132 | New-NinjaRMMError @ErrorRecord
| ~~~~~~~~~~~~
| Cannot process argument transformation on parameter 'ErrorRecord'. Cannot convert the "The term
| 'dotnet' is not recognized as a name of a cmdlet, function, script file, or executable program. Check
| the spelling of the name, or if a path was included, verify that the path is correct and try again."
| value of type "System.Management.Automation.ErrorRecord" to type "System.Exception".

PS Version is 7:

PS C:\Users\username> get-host | select version
Version

7.1.4

Do you have any idea whats the reason?

Greetings from Germany

Find-NinjaOneDevices 500 Error

I've been trying this out, and used this code set (secrets and etc removed).
` UseClientAuth = $True
}

Connect-NinjaOne @ReconnectionParameters
$list = Find-NinjaOneDevices -query '172.20' -limit 3
foreach ($item in $list) {
write-host "---------------------"
write-host $item
}`
However, all I'm getting is this error. Any help, directions to go, etc would be greatly appreciated
image

editing to add that the query in the api documentation works, so it's not pulling a null result
https://srkagroup.rmmservice.com/apidocs/?links.active=core#/system/search

Connect fails with 404

It would seem that the auth URLS may have changed - I'm now getting 404 errors when trying to auth:

VERBOSE: Making token request to https://ca.ninjarmm.com:443/oauth/token
VERBOSE: Requested HTTP/1.1 POST with 218-byte payload
VERBOSE: Received HTTP/1.1 146-byte response of content type text/html
Invoke-WebRequest: 404 Not Found 404 Not Found nginx

Looks like the path should be /ws/oauth/token now.

incomplete ticket data when using Get-NinjaOneTicketLogEntries

when I run Get-NinjaOneTicketLogEntries -ticketID '1015'

I get back

@{id=69; appUserContactUid=; type=SAVE; body=Ticket updated by Automation 'Close Tickets Trigger'; htmlBody=; isEmailResponse=False; fullEmailBody=; publicEntry=True; system=True; createTime=1661881121.958; changeDiff=; activityId=; timeTracked=} @{id=61; appUserContactUid=1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d; type=SAVE; body=Ticket updated; htmlBody=; isEmailResponse=False; fullEmailBody=; publicEntry=True; system=True; createTime=1661792032.645; changeDiff=; activityId=; timeTracked=} @{id=60; appUserContactUid=1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d; type=COMMENT; body=performed fake task that took 1 and a half hours; htmlBody=<p>performed fake task that took 1 and a half hours </p>; isEmailResponse=False; fullEmailBody=; publicEntry=True; system=False; createTime=1661792022.011; changeDiff=; activityId=; timeTracked=5400} @{id=59; appUserContactUid=1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d; type=SAVE; body=Ticket created; htmlBody=; isEmailResponse=False; fullEmailBody=; publicEntry=True; system=True; createTime=1661791970.832; changeDiff=; activityId=; timeTracked=} @{id=58; appUserContactUid=1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d; type=DESCRIPTION; body=example ticket that will be used with invoice ninja; htmlBody=<p>example ticket that will be used with invoice ninja </p>; isEmailResponse=False; fullEmailBody=; publicEntry=True; system=False; createTime=1661791970.823; changeDiff=; activityId=; timeTracked=0}

when I use my browser to go to https://app.ninjarmm.com/v2/ticketing/ticket/1015/log-entry I get

[{"id":69,"appUserContactUid":null,"type":"SAVE","body":"Ticket updated by Automation 'Close Tickets Trigger'","htmlBody":null,"isEmailResponse":false,"fullEmailBody":null,"publicEntry":true,"system":true,"createTime":1661881121.958000000,"changeDiff":{"status":{"new":"CLOSED","old":"RESOLVED"}},"activityId":null,"timeTracked":null},{"id":61,"appUserContactUid":"1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d","type":"SAVE","body":"Ticket updated","htmlBody":null,"isEmailResponse":false,"fullEmailBody":null,"publicEntry":true,"system":true,"createTime":1661792032.645000000,"changeDiff":{"status":{"new":"RESOLVED","old":"NEW"}},"activityId":null,"timeTracked":null},{"id":60,"appUserContactUid":"1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d","type":"COMMENT","body":"performed fake task that took 1 and a half hours","htmlBody":"<p>performed fake task that took 1 and a half hours </p>","isEmailResponse":false,"fullEmailBody":null,"publicEntry":true,"system":false,"createTime":1661792022.011000000,"changeDiff":{},"activityId":null,"timeTracked":5400},{"id":59,"appUserContactUid":"1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d","type":"SAVE","body":"**Ticket created","htmlBody":null,"isEmailResponse":false,"fullEmailBody":null,"publicEntry":true,"system":true,"createTime":1661791970.832000000,"changeDiff":{"ccList":{"new":{"uids":null,"emails":[]},"old":null},"nodeId":{"new":{"name":"customer user"},"old":null},"source":{"new":"TECHNICIAN","old":null},"status":{"new":"NEW","old":null},"summary":{"new":"Test Ticket do not bill 1","old":null},"clientId":{"new":{**"name":"Customer name"},"old":null},"priority":{"new":"MEDIUM","old":null},"severity":{"new":"MODERATE","old":null},"locationId":{"new":{"name":"Main Office"},"old":null},"requesterUid":{"new":{"name":"my name** "},"old":null},"ticketFormId":{"new":{"name":"Default"},"old":null},"attributeValues":[{"new":"true","old":null,"attributeId":**{"id":1,"name":"Site Visit","attributeType":"CHECKBOX"}}],"assignedAppUserId":{"new":{"name":"my name"},"old":null}},"activityId":null,"timeTracked":null},{"id":58,"appUserContactUid":"1b0f9d59-e236-4a8c-9ba7-b3bfeb9e505d","type":"DESCRIPTION","body":"example ticket that will be used with invoice ninja","htmlBody":"<p>example ticket that will be used with invoice ninja </p>","isEmailResponse":false,"fullEmailBody":null,"publicEntry":true,"system":false,"createTime":1661791970.823000000,"changeDiff":{},"activityId":null,"timeTracked":0}]

noteably its missing the customer name and the name of the person who worked on the ticket

not sure if I'm doing something wrong or if part of the response is being parsed out

Problem with "Secure" custom fields "SECURE_VALUE_PLACEHOLDER_"

Hello,

I have a problem with reading "secure" custom fields.

I have a custom field of type "Secure" in NinjaOne when I get the value from the custom field in Ninjaone, or with the ninjaone api the correct value is returned, when I get the value with the PowerShell module there is put "SECURE_VALUE_PLACEHOLDER_" in front of the value.

Example:
PS C:\Users\username> Get-NinjaOneDeviceCustomFields -deviceId "3316"
...
SecureCF : SECURE_VALUE_PLACEHOLDER_asdabs-ioaoia-123123-asd
...

When I get the vaule via api "curl -X 'GET' \ 'https://tennant.rmmservice.eu/v2/device/3316/custom-fields' "
{
...
"huduproxyauth": "asdabs-ioaoia-123123-asd",
...
}

In the NinjaOne Forum, I found an old thread mentioning the same placeholder, but I can not connect the dots myself.

Greetings, Stefan

Build Failed

Downloaded and installed the latest .NET SDK (v6.0.302) in order to establish connection to the NinjaOne API. Input my information and executed "Connect-NinjaOne". Page came up in my browser and I gave my authorization. Site redirected to, "localhost refused to connect". Went back to powershell console and received "the build failed The build failed. Fix the build errors and run again.". Ran netstat to confirm nothing was listening on my specified port.

Uninstalled .NET SDK 6.0 and installed the latest .NET SDK 5.0 (v5.0.408). Restarted powershell console and browser and attempted same command. This time, received my refresh token. Able to confirm connection to API through several of the Get-* cmdlets

Successfully installed but all calls come up with New-NinjaOneError -ErrorRecord $_

Hey thanks for maintaining this, I'm looking into using it but seem to be hitting a wall with a generic error of "New-NinjaOneError -ErrorRecord $_"

Regardless the module that I call (though I've randomly tested a few).

Is there something specific I can check for that I may be missing? I am able to connect using the clientid and clientsecret, but on the page that loads I also get an error message there. . Copied below.

{ "resultCode": "FAILURE", "errorMessage": "HTTP 404 Not Found", "incidentId": "WEB_MGMT_SERVICE-2a-1654890304-TFZFNUTF" }

Hope you can help

paid programming for this library

Would like to hire you to complete a function in your powershell for ninja one..

seems ninja doesnt want to help at all.

please contact me for more information

Does not want to connect.

Hi.

So I am very very green on the API Webcalls but i followed the guide to a T but i get the following error.

{ "resultCode": "FAILURE", "errorMessage": "HTTP 404 Not Found", "incidentId": "WEB_MGMT_SERVICE-1a-1631107956-UGUBDHNX" }

Think its something to do with the redirect URI but not sure what it is.

Thanks

Ticketing functions not working for me

First off thank you so much for this work!

I can get most "GET" functions to work as expected except for the ticket functions I get

The NinjaOne API said FAILURE: NullPointerException. The API returned the following HTTP error response: 500 Internal Server Error

when I try to run Get-NinjaOneTicketLogEntries -ticketID '1014' same if I leave off the ticketid and respond to the prompt in the script

in the ninja documentation it looks like you have to now specify another field like description, this is the url that the documentation spit out to me https://app.ninjarmm.com/v2/ticketing/ticket/1014/log-entry?type=DESCRIPTION I try to do an invoke-webrequest with this url but this api is over my head and I have no idea what i'm doing,

I just want to pull out ticket details so I can generate an invoice for work done

Thank you for any help!

Get-NinjaOneTickets not returning any results

Public/Get/Ticketing/Get-NinjaOneTickets.ps1 returns no results for any of the sample queries.

After connecting I can query boards as expected.

but "Get-NinjaOneTickets -boardId 2" returns nothing. boardID 2 is clearly valid
Boards

but
"Get-NinjaOneTickets -boardId 2" returns nothing as does querying for a specific ticket "Get-NinjaOneTickets -ticketID 1317"
If I query for a ticket I know doesn't exist I get an error, but nothing is returned for a valid ticket.

Tickets

I tried release candidate 1.12.3 as well as the current prerelease version

Get-NinjaOneInstaller - Unhelpful Error message

Get-NinjaOneInstaller fails with "resultCode": "invalid_node_role" when "Advanced installer options:" is "On" (Admin > General > Settings, at the bottom).

There does not seem to be a way to pass nodeRoleID via the Get method, which seems to be a limitation on the API itself.

I would suggest the module catch this error from the API, and provide a more useful error message, such as saying the command is not compatible with Advanced Installer options on and/or suggesting using New-NinjaOneInstaller.

Unable To Connect To API Endpoint

Good Day,

I am unable to run the Update-NinjaOneNodeRolePolicyAssignment cmd-let, I receive the following message:

New-NinjaOneError: C:\Users\dgoldstein\Documents\PowerShell\Modules\NinjaOne\1.9.0\Public\Update\Update-NinjaOneNodeRolePolicyAssignment.ps1:46:9
Line |
46 | New-NinjaOneError -ErrorRecord $_
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The NinjaOne API said insufficient_privileges. The API returned the following HTTP error response: 401 Unauthorized The API did not provide a response code or status.
PS C:\Users\dgoldstein> Update-NinjaOneNodeRolePolicyAssignment

I can successfully run the connect-ninjaone cmd-let with the following:
Connect-NinjaOne -Instance 'us' -ClientID 'CLIENT_ID' -ClientSecret 'CLIENT_SECRET' -Scopes management -ShowTokens -Verbose -UseClientAuth

Please advise.

Thank you in advance.

Format of returned dates

i am guessing the below is a date of some sort?

created : 1624014024,761
lastContact : 1631110371,339
lastUpdate : 1631110372

How is it structured? like ddmmyyyy or what? it does not make sense to me lol

Originally posted by @duffman36 in #3 (comment)

Help listing Unapproved devices (pending,declined)

Hey @homotechsual hope I'm not a bother yet, and I hope you don't mind.

I'm working to try and pull a list of devices in a status other than Approved and while I don't believe this is a limit on this PS Module (and I'm leaning towards it being a NRMM issue I wanted confirmation). Can you look at the below and tell me if I'm wrong here and just doing something wrong?

image

image

I have a running topic in their DOJO community as well, https://ninjarmm.zendesk.com/hc/en-us/community/posts/6908556140557-Ninja-API-Pending-Device-list

Get-NinjaOneActivities -class "SYSTEM" has other types included

Not sure if this is a bug in this powershell library or of the NinjaAPI, but running the get-NinjaOneActivities by class type returns mixed results (different class types)

(Get-NinjaOneActivities -class "SYSTEM"-pagesize 1000).activities

For example "SYSTEM" is returning "SYSTEM", "SCRIPTING" and "SCHEDULED_TASK". Possible others

Activities

(feat) Aliases

Add aliases for all pluralised commands to cover the singular - e.g aliase Get-NinjaOneDevice to Get-NinjaOneDevices.

Invoke-NinjaOneDeviceScript

Cant get this to work
But i seem to not be able to get it to work with the native api aswell.
I just want to call a script with powershell :(
Ie, call scripts within scripts

I get this with your module

Line |
  66 |          New-NinjaOneError -ErrorRecord $_
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The NinjaOne API said FAILURE: NullPointerException. The API returned the following HTTP error response: 500 Internal Server Error

And this with a Rest invoke

Invoke-RestMethod: { "resultCode": "FAILURE", "errorMessage": "NullPointerException", "incidentId": "WEB_MGMT_SERVICE-2a-1683267369-FPCHHYPJ" }

How to use update-ninjaonedevice?

I have tried the following:

# Define the new device information
$deviceInformation = @{
    systemName = "Bob"
}

# Call the Update-NinjaOneDevice function
Update-NinjaOneDevice -deviceId 666 -deviceInformation $deviceInformation
```

but I get 

```
Get-NinjaOneDevice: The term 'Get-NinjaOneDevice' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
```

I've also tried using friendlyName instead of SystemName, to the same result.

Get-NinjaOneActivites -after and -before not passed to GET request.

When running Get-NinjaOneActivities, the cmdlet transforms the DateTime object to Unix Epoch timestamp but it does not append it to the GET request made to the NinjaRMM API endpoint.

Example

PS > $Date                                         

Monday, 8 May 2023 9:45:42 am

PS > Get-NinjaOneActivities  -before $Date -verbose
VERBOSE: Converted 05/08/2023 09:45:42 to Unix Epoch timestamp 1683503142
VERBOSE: Building parameters for Get-NinjaOneActivities. Use '-Debug' with '-Verbose' to see parameter values as they are built.
VERBOSE: Retrieving all device activities.
VERBOSE: Building [HttpQSCollection] for New-NinjaOneGETRequest
VERBOSE: Making a GET request to https://oc.ninjarmm.com:443/v2/activities
VERBOSE: HTTP/1.1 GET with 0-byte payload
VERBOSE: received -byte response of content type application/json

Invoke-NinjaOneRequest as a cmdlet.

I think what would make this great module even better is to add an ability to leverage the modules management of authorisation to make requests directly to the API.

Ideally this would be similar to Invoke-MGGraphRequest listed here Microsoft Documentation

With support for parameters such as -Method, -URI etc.

Clearing a Custom Field

Hello,

i am struggle to clear a custom field.
I set set a new value no problem, but clearing seems to be an issue. Setting "" or $null will not change the ninja field.
There is no error and nothing happens.

To replicate - Create a custom field of type string and set a value - now try something like:
Set-NinjaOneDeviceCustomFields -deviceId 4210 -deviceCustomFields @{"nameOfField" = ""}

kind of help ?

Hello,

i have done the setup as described. Running PS 7. But if i use the command with my own values like:
"Connect-NinjaRMM -Instance 'eu' -ClientID 'ABCDEfGH-IjKLmnopqrstUV1w23x45yz' -ClientSecret 'abc123abc123def456def456ghi789ghi789lmn012lmn012' -Port 9090 -UseWebAuth -ShowTokens" i only reach an error from Ninja with contains:

grafik

Any suggestions?

localhost config is done by setup the basics in Ninja, tested local, it is reachable and it shows me the result:
ERROR: Unable to retrieve authorisation code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.