Samples/AssignUpdateprofileForClient.ps1
# Assigns an updateprofile to an windowsendpoint by replacing his updateprofileId with the pagesize of 3 (Get and Patch example) $logicalGroupName = "YourLogicalGroup" $updateProfileID = "YourUpdateprofileID" $pageSize = 3 try { # Get the logical group $logicalGroup = Get-bCEndpointsLogicalGroups -Name $logicalGroupName # retrieve the logical group id $logicalGroupID = $logicalGroup.data[0].id # Get the endpoints out of the logical group $endpointsLogicalGroup = Get-bCEndpointsEndpointsByLogicalGroupId -LogicalGroupId $logicalGroupID -PageSize $pageSize # for loop iterates through the pages for($i = 1; $i -le $endpointsLogicalGroup.totalPages; $i++){ # Get the endpoints of the current page $endpointsPage = Get-bCEndpointsEndpointsByLogicalGroupId -LogicalGroupId $logicalGroupID -Page $i -PageSize $pageSize # create the patch operation assignment $operation = Initialize-bCPatchOperation -Value $updateProfileId -Path "/updateProfileId" -Op "replace" foreach($endpointData in $endpointsPage.data){ # retrieve the endpoint id $endpointID = $endpointData[0].id # Assign an Updateprofile to an endpoint Update-bCUpdatemanagementWindowsEndpoint -Id $endpointID -Operation $operation } } } catch { Write-Error "Error occured: $($_.Exception)" } |