I am trying to use PrincipalContext to check if a local user group exists on a remote computer.
I am having problems with PrincipalContext
:
PrincipalContext ctx = new PrincipalContext(ContextType.Machine, machine, null, ContextOptions.Negotiate)
It works in such scenarios:
- local to local machine
- local to virtual machine
- domain machine to workgroup machine
However it doesn't work in opposite direction:
- virtual machine to local host
- workgroup machine to domain machine
I am getting these errors:
Unhandled Exception: System.IO.FileNotFoundException: The network path was not found.
Unhandled Exception: System.Runtime.InteropServices.COMException: The network path was not found.
The first exception is for virtual machine, second for workgroup machine.
All machines have user with the same name and password and the code was executed from that user.
How to solve this issue?