Skip to content

Instantly share code, notes, and snippets.

@OlivierLaflamme
Created January 24, 2022 16:03
Show Gist options
  • Save OlivierLaflamme/158e06ebfe3cbd5356f650871c077b87 to your computer and use it in GitHub Desktop.
Save OlivierLaflamme/158e06ebfe3cbd5356f650871c077b87 to your computer and use it in GitHub Desktop.
Check if domain joined
bool isPartofDomain()
{
NET_API_STATUS nas;
_NETSETUP_JOIN_STATUS status;
LPWSTR buf = NULL;
nas = NetGetJoinInformation(NULL, &buf, &status);
if (nas == NERR_Success)
{
if (status == NetSetupDomain)
{
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment