Skip to content

Invoke-AutopilotGroupTagAssignment

SYNOPSIS

Assign group tags to Autopilot devices based on Ivanti and Intune data.

SYNTAX

CIName

Invoke-AutopilotGroupTagAssignment [-CIName <String>] [-ivantiInstance <String>] [-ivantiTask <Object>]
 [-Logfile <String>] [-test] [<CommonParameters>]

CISerial

Invoke-AutopilotGroupTagAssignment [-CISerial <String>] [-ivantiInstance <String>] [-ivantiTask <Object>]
 [-Logfile <String>] [-test] [<CommonParameters>]

DESCRIPTION

This function connects to Ivanti and Microsoft Intune to retrieve device information, processes the data, and assigns group tags to Autopilot devices. It uses Ivanti SQL queries and Microsoft Graph API to ensure devices are properly tagged.

EXAMPLES

EXAMPLE 1

Invoke-AutopilotGroupTagAssignment -CIName "Device01" -ivantiInstance "IvantiProd"

Assigns group tags to the Autopilot device with the name "Device01" using the "IvantiProd" instance.

EXAMPLE 2

Invoke-AutopilotGroupTagAssignment -CISerial "123456789" -ivantiInstance "IvantiQA" -test

Simulates assigning group tags to the Autopilot device with the serial number "123456789" using the "IvantiQA" instance.

EXAMPLE 3

Invoke-AutopilotGroupTagAssignment -CIName "Device02" -ivantiTask "12345" -Logfile "C:\Logs\GroupTagAssignment.log"

Assigns group tags to the Autopilot device with the name "Device02" using parameters from Ivanti task "12345" and logs the operation to the specified log file.

PARAMETERS

-CIName

The name of the Configuration Item (CI) to process for group tag assignment.

Type: String
Parameter Sets: CIName
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-CISerial

The serial number of the Configuration Item (CI) to process for group tag assignment.

Type: String
Parameter Sets: CISerial
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ivantiInstance

The Ivanti instance to connect to. Default is "IvantiQA".

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: IvantiQA
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ivantiTask

The Ivanti task number to retrieve additional parameters for group tag assignment.

Type: Object
Parameter Sets: (All)
Aliases:

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

-Logfile

The path to the log file where operation details will be recorded. Default is a timestamped log file in the Intune logs folder.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: ("\\stadgent\dumps\Logs\Intune\$((Get-Date).toString('yyyyMMdd'))_Assign-AutopilotGroupTag.log")
Accept pipeline input: False
Accept wildcard characters: False

-test

A switch to run the function in test mode without making changes.

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