I've looked at several threads on how to do this and with what I've learned it works for my Mojave test machine but not Catalina. In Catalina it enabled but just hangs when trying to connect unless enabled manually. If enabled manually it works fine.
I have a configuration profile assigned with an identifier of com.apple.screensharing.agent
Code requirement: identifier "com.apple.screensharing.agent" and anchor apple
and post event of Allow.
In a policy I have the following script run...
#! /bin/sh
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -specifiedUsers
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -users $4 -access -on -privs -ControlObserve -ShowObserve -clientopts -setmenuextra -menuextra yes
exit
Can someone shed some light on things?