Already a NinjaOne customer? Log in to view more guides and the latest updates.

PowerShell: Ninja-Property-Docs-Clear-Single

Topic

This article explains how to use Ninja-Property-Docs-Clear-Singleto clear the value of a specified custom field in a single document.

If you use the NinjaOne PowerShell Module outside of an automation script, you may need to adjust PowerShell's execution policy. For more information about execution policies, refer to Microsoft's documentation: about Execution Policies (external link).

Environment

  • NinjaOne
  • Microsoft PowerShell

Description

The Ninja-Property-Docs-Clear-Single cmdlet clears the value of a specified custom field in a single document. You can specify the field name using the -AttributeName parameter and the document using the -TemplateName parameter. The cmdlet will remove any existing value from the custom field, effectively resetting it to an empty state. 

Only fields with automation write permissions can be reset using this cmdlet. The custom field value will be cleared after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes. The device executing this cmdlet must be assigned as a documentation delegate for the document containing the custom field to be cleared.

Syntax

Ninja-Property-Docs-Clear-Single [[-TemplateName] <Object>] [[- AttributeName] <Object> [<CommonParameters>]

Examples

Example 1: Clear a Custom Field in a Single Document

PS C: Ninja-Property-Docs-Clear-Single -TemplateName "My Example Document" -AttributeName "exampleAttribute"

The specified custom field in the document is cleared after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes.

Parameters

-AttributeName

Specify the name of the custom field you want to clear in the document.

Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateName

Specify the name of the document template containing the custom field you want to clear.

Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Inputs

System.String

This cmdlet does not accept input from the pipeline. The -AttributeName and -TemplateName parameters accept string values representing the name of the custom field to clear and the name of the document template, respectively.

Outputs

None

  • The device executing this cmdlet must be assigned as a documentation delegate for the
    document containing the custom field to be cleared.
  • Automation write permissions are required to clear any custom field value. For information about permissions for custom fields refer to NinjaOne Custom Fields: Getting Started.
  • The custom field value will be cleared after the next successful sync with the NinjaOne
    platform, which typically occurs within a few minutes.

Additional Resources

For more information about asset management and custom scripting, refer to the following resources:

FAQ

Next Steps