Determining the PrivUserGroup CRM is using.
This was a fun little exercise.
As it turns out,
SELECT [OrganizationId]
,[UserGroupId]
,[PrivilegeUserGroupId]
FROM [dbo].[OrganizationBase]
Will get you the information you need.
We needed to find this out due to a couple of aborted installs on the same machine, since CRM creates the PrivUserGroup each time it installs unless told to use a specific existing group.
The group name includes the GUID you find in OrganisationID. The PrivilegeUserGroupId is the objectGUID in the AD.
As an interesting aside, the binary vs string formatting of GUIDs is a little weird
{01020304-0506-0708-090A-0B0C0D0E0F00} in binary format is:
04030201060508070A09000D0E0D0C0B