Hello there
I have a problem with an Powershell Command from Module MicrosoftGraph.
Maybe is there anyone the can tell my what the correct command are.
The command
Set-MgDeviceManagementDeviceConfiguration -DeviceConfigurationId $deviceConfigurationId -BodyParameter $params
With this body
$params = @{
Assignments = @(
@{
Target = @{
"@odata.type" = "#microsoft.graph.groupAssignmentTarget"
GroupId = <"GroupID">
}
}
)
}
It’s working but remove all another assigned groups.
So I think the correct command will be the following:
Update-MgDeviceManagementDeviceShellScript -DeviceShellScriptId $deviceShellScriptId -BodyParameter $params
But what is the correct Body and how do assign with more groups of times?
I have also tried with the following command:
Update-MgDeviceManagementDeviceShellScript -DeviceShellScriptId "0cee72b4-6af0-4d25-96c1-ece01bd885f3" -GroupAssignments [TargetGroupId <GroupId>]
But I get a mistake back:
Update-MgDeviceManagementDeviceShellScript: Cannot process argument transformation on parameter 'GroupAssignments'. Cannot convert value "[TargetGroupId" to type "Microsoft.Graph.PowerShell.Models.IMicrosoftGraphDeviceManagementScriptGroupAssignment[]". Error: "Cannot convert the "[TargetGroupId" value of type "System.String" to type “Microsoft.Graph.PowerShell.Models.IMicrosoftGraphDeviceManagementScriptGroupAssignment"."
Here link to Microsoft about this:
Update deviceShellScript - Microsoft Graph beta | Microsoft Docs.
I would be very happy if anyone could help me with my problem.
Regards Andreas