Highlighted
Posted by
Digon

Policy Assigment Not Working

Policy Assigment seems Not Working.

I assigned the policy to the group, but the devices are not "inheritaging".

In the management console, the "policy" column is empty for every devices.

When I assign a policy directly to the device from the device's properties, the property is not changed.

When use Assign Teamviewer policies button under Design & Deploy, it get stuck on "assigning policy".

1 Reply
1 Reply
Highlighted
Posted by
Digon

Re: Policy Assigment Not Working

Two months later, no answer from TV staff...

I found by myself how to correctly apply policy;

  • The devices in the group don't inherit the policy if a policy is applied to the group after the devices has been added to the group: you need to change the policy to "inherit" on all devices
  • Moving the devices to a new group with policy applied don't work either.
  • Assign to many devices still get stuck on assigning policy with Internet Explorer, it works with Firefox ans Chrome but the javascript get frequently stucked.

The only reliable way I found is to use the API to force inherit on all devices in a group:

 

$token = "XXXXX"
$bearer = "Bearer",$token
$header = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$header.Add("authorization", $bearer)
# Récupérer l'ID du groupe [NAME]
$request = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/groups?name=GROUPNAME" -Method Get -Headers $header
$GroupID = $request.groups.id
# Récupérer tous les devices du groupe [NAME]
$request = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/devices?groupid=$GroupID" -Method Get -Headers $header

$data = @{        
    policy_id = "inherit";
};
$json = $data | ConvertTo-Json;
$contentType = "application/json" 

ForEach($item in $request.devices)
{
    # On passe en mode hériter
    if($Item.policy_id -notlike "inherit"){
        $Item.alias
        $DeviceID = $Item.device_id
        # Appliquer la stratégie
        $request = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/devices/$DeviceID" -ContentType $contentType -Method Put -Headers $header -Body $Json
        $x++
    }
    
}
write-host $x

I think that policy apply should be improved and the way it works well documented.

Hope this post will help.