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

PowerShell: Ninja-Property-Docs-Get-Single

Topic

This article explains how to use Ninja-Property-Docs-Get-Singleto retrieve 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-Get-Single cmdlet retrieves 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 returns the current value of the custom field in the specified single document.

Only document fields with automation read permissions can be retrieved using this cmdlet.

Syntax

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

Example

Retrieve a Value from a Single Document

PS C:> Ninja-Property-Docs-Get-Single -TemplateName "My Example Document" -
AttributeName "exampleAttribute"
Mötley Crüe

The value of the custom field "exampleAttribute" in the single document "My Example Document" is retrieved and displayed in the output.

Parameters

-AttributeName

Specify the name of the custom field you want to retrieve from 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 single document containing the custom field you want to retrieve.

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
retrieve and the name of the single document, respectively.

Outputs

System.String[]

The cmdlet returns the value of the specified custom field in the specified single document as a string or an array of strings if more than one line is present.

Only document fields with automation read permissions can be retrieved using this cmdlet. For information about permissions for custom fields refer to NinjaOne Custom Fields: Getting Started.

Additional Resources

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

FAQ

Next Steps