NetShareCheck

[DllImport("netapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern uint NetShareCheck(
   string servername,
   string device,
   out uint type
);

Microsoft documentation: Link

Last updated