# Getting Started

### Step 1 - Select / Install a machine to run scripts

I highly recommend using a dedicated Windows Server Core machine for running scripts which will not be used for anything else. The machine used for scripts should not be accessible by anyone other than your System Administrator accounts. I also recommend running it as a VM in a secured data centre. This machine will get access to the API Keys for all of your services which is why it is important to keep it secure.

### Step 2 - Create a new Organization

In NinjaOne create a new organization which will house the machine you wish to use for executing scripts.

### Step 3 - Create a custom role for your script running machine

Depending on if you are using a Windows Desktop or Server operating system for executing scripts, create a new custom role under the corresponding role types inside NinjaOne

### Step 4 - Update Technician Permissions

Update your technician roles and permissions to allow access to both the role and organization to only system administrators. This is because the machine needs to have access to secure custom fields which will store client\_credentials API credentials. These credentials have the equivalent of system administrator permissions which are why these restrictions should be put in place.

### Step 4 - Install NinjaOne Agent / Move Machine

Install the NinjaOne Agent for the new Organization you created or move the machine you wish to use to that organization. Once it is installed edit the device and update the role to be the new one you created.

### Step 5 - Add Role Custom Fields

All the automated documentation scripts will require NinjaOne API details stored in secure custom fields. These should be role custom fields and only assigned to your script runner role. Some scripts will also require the addition of extra role fields to store API credentials for services they are integrating with as well as the addition of global custom fields to store the data that gets generated. The guides for specific integrations will detail what the requirements are.

The core role custom fields are:

| Display Name           | Name                 | Type   | Permissions                                                        | Description                                                                                   |
| ---------------------- | -------------------- | ------ | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| NinjaOne Client ID     | ninjaoneClientId     | Secure | <p>Technician: Editable<br>Automations: Read Only<br>API: None</p> | Stores the API Client ID                                                                      |
| NinjaOne Client Secret | ninjaoneClientSecret | Secure | <p>Technician: Editable<br>Automations: Read Only<br>API: None</p> | Stores the API Client Secret                                                                  |
| NinjaOne Instance      | ninjaoneInstance     | Text   | <p>Technician: Editable<br>Automations: Read Only<br>API: None</p> | Stores the name of the NinjaOne Instance used for example app.ninjarmm.com or eu.ninjarmm.com |

Please make sure the field names match exactly, it is possible to use different names if you wish, but this will require you to edit the automated documentation scripts.

### Step 6 - Assign fields to your script role

Assign the newly created custom fields to the role you created.

### Step 7 - Create API Credentials

Create a new Machine to Machine API application with client credentials authentication and the monitoring and management scopes.

### Step 8 - Set the credentials at the device level custom fields

Set the credentials you generated at the device level custom fields for your script running machine.

### Step 9 - Create Overview Company

Create a new company in NinjaOne called 'Global Overview' This is used for populating reports and other information across all companies.

### Step 10 - Schedule scripts

Follow the setup instructions for specific scripts and then override the device policy to schedule them in.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mspp.io/ninjaone-auto-documentation/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
