As is mentioned in the manual, the KXRPC service is not needed for Domain Global groups, only for Local groups.

So you tell us what you have in your script, Global or Local groups?

There are other factors such as protocols and provider order that can cause InGroup() to fail so you need to test and validate.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.