I use net.exein my program to view all the computers in the workgroup.
The code is as follows:
var net = new Process();
net.StartInfo.FileName = "net.exe";
net.StartInfo.CreateNoWindow = true;
net.StartInfo.Arguments = @"VIEW /DOMAIN:my-workgroup";
net.StartInfo.RedirectStandardOutput = true;
net.StartInfo.UseShellExecute = false;
net.StartInfo.RedirectStandardError = true;
net.Start();
The command works great when executed in the shell, but when I use the code shown, the command returns the device is not connected.
I also tried to run the program as an administrator, and that doesn't make any difference.
The domain name indicated is actually a workgroup .
For net.exeworks in a shell, indicating that the workgroup is working fine.
, , net view . , Process.Start() - .
- Process.Start()?