NinjaOne – PSWarranty Support
As some of you may know I have recently started working at NinjaOne as a Product Lead. My day job no longer consists of writing PowerShell or automating things, so now I just get to do it as a hobby 🙂 One of the first things I noticed was that NinjaOne didn’t have support in Kelvin’s PSWarranty module for being able to lookup and set the warranty for devices in bulk. I have added support for that now and you can find it in the main module here:
Note: This is a community project and not officially supported by NinjaOne, if you have any issues please leave a comment on this blog or open an issue on the GitHub repository.
To make use of this to lookup the warranty expiry for all devices in NinjaOne that are supported, the first thing you will need to do is add a new global device custom field called something like “Warranty Expiry”. This can be found under Administration -> Devices -> Global Custom Fields. Choose to add a new field and make it a Date type. Make a note of the “Field Name”
Next you will need to create a new Ninja API key for use with the module, go to Administration -> Apps -> API Choose to add a new key. Set it to be an API Services (machine-to-machine) type. Give it a name. Set the Scopes to Monitoring and Management and give it the Client Credentials grant type.
Once you save perform the MFA check and copy the secret.
From the all API screen copy the Client ID for the app you created.
Next if you want to check Dell warranties you will need to obtain an API key from Dell. You can do this from the Tech Direct site https://tdm.dell.com/portal
Now you should have all the details you need. Open up a PowerShell terminal and install the module:
Next set your Dell API Keys for the module:
Set-WarrantyAPIKeys -DellClientID "Your Dell Client ID" -DellClientSecret "Your Dell Client Secret"
Finally run the command to synchronize warranty details to Ninja, putting in your client ID and secret, your Ninja instance UR and the field name:
Update-WarrantyInfo -Ninja -NinjaClientID "YourAPIClientID" -NinjaSecret "YourAPISecret" -NinjaURL "https://eu.ninjarmm.com" -NinjaFieldName "warrantyExpiry" -SyncWithSource -OverwriteWarranty -ExcludeApple
The script should now run and set the custom field for any supported devices.