---
updatedAt: 2025-08-14T18:20:10.000Z
agentTools:
  siteIndex: https://developer.n-able.com/llms.txt
  projectIndex: https://developer.n-able.com/n-central/llms.txt
---

# NC Rest API - Set Custom Property for Multiple Devices

```powershell PowerShell
######################################################################################################################################
#You must be authenticated with API to run this script, you can use NC Rest API - Exchange JSON for Access Token.ps1 to authenticate # 
#This script will set the value of a single custom property, based on the name of the property far all devices in N-central          #
#This script uses the CSV file from the Export Custom Propery for Multiple Devices script                                            #
#This data is imported from C:\Temp\DeviceCustomProperties.csv, you can edit this on the $inputCsvPath line                          #
######################################################################################################################################

# Define customer and custom property name to filter
$customerID = 50
$customPropertyName = "XXXXXXXXXXXXXXXX" #Enter Custom Device Property Name Here


# Define your CSV file location used in the export script
$inputCsvPath = "C:\Temp\DeviceCustomProperties.csv"

# Function to update a custom property of a device
function NCentral-UpdateDeviceCustomProperty {
    param (
        [string]$apiUrl,
        [string]$accessToken,
        [string]$deviceId,
        [string]$propertyId,
        [string]$newValue
    )
    $uri = "$apiUrl/api/devices/$deviceId/custom-properties/$propertyId"
    $headers = @{
        "Authorization" = "Bearer $accessToken"
    }
    $body = @{
        "value" = $newValue
    } | ConvertTo-Json
    $response = Invoke-RestMethod -Uri $uri -Method Put -Headers $headers -Body $body -ContentType "application/json"
    return $response
}

# Read the modified CSV file
$modifiedTable = Import-Csv -Path $inputCsvPath

# Update the custom properties based on the modified CSV file
foreach ($row in $modifiedTable) {
    $deviceId = $row.'Device ID'
    $propertyId = $row.'Property ID'
    $newValue = $row.'Value'

    $updateResponse = NCentral-UpdateDeviceCustomProperty -apiUrl $apiUrl -accessToken $accessToken -deviceId $deviceId -propertyId $propertyId -newValue $newValue
}

Write-Host "Completed updating custom properties based on $inputCsvPath"

```

```json Response Example
{"success":true}
```

# Download PS1 file





# Authenticate using the NC Rest API - Exchange JSON for Access Token.ps1 script





# Adjust the CustomerID if you only want to import one Customer





# Use the CSV file created by the script NC Rest API - Export Custom Property for Multiple Devices to make changes





# Specify the Custom Property Name you wish to import





# Run the PowerShell Script