Skip to content

Add-ADObjectNotes

SYNOPSIS

Adds a note to an Active Directory object and logs the action in a database.

SYNTAX

Add-ADObjectNotes [-Identity] <String> [-Task] <Int32> [-Action] <String> [[-ScriptPath] <String>]
 [-Date <DateTime>] [-Who <String>] [-Unique] [<CommonParameters>]

DESCRIPTION

The `Add-ADObjectNotes` function retrieves an Active Directory object based on the provided identity, adds a note with the specified task and action, and logs the details in a SQL database for auditing purposes.

EXAMPLES

EXAMPLE 1

Add-ADObjectNotes -Identity "CN=John Doe,OU=Users,DC=example,DC=com" -Task 123 -Action "Updated user permissions"

Adds a note for the specified Active Directory object with task ID 123 and logs the action "Updated user permissions" in the database.

EXAMPLE 2

Add-ADObjectNotes -Identity "jdoe" -Task 456 -Action "Disabled user account" -Date "2025-03-31"

Adds a note for the user "jdoe" with task ID 456, logs the action "Disabled user account," and sets the action date to "2025-03-31."

PARAMETERS

-Identity

The identity of the Active Directory object (e.g., DistinguishedName, GUID, or SamAccountName).

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Task

The task ID associated with the action being logged.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-Action

The note or action description to be added to the Active Directory object.

Type: String
Parameter Sets: (All)
Aliases: Note

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ScriptPath

{{ Fill ScriptPath Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Date

The date of the action. Defaults to the current date in 'yyyy-MM-dd' format.

Type: DateTime
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: (Get-Date -Format 'yyyy-MM-dd')
Accept pipeline input: False
Accept wildcard characters: False

-Who

{{ Fill Who Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: ($env:USERNAME)
Accept pipeline input: False
Accept wildcard characters: False

-Unique

A deprecated parameter that is no longer applicable and will be removed in the future.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES