public void Test1() { // 执行 net use,建立到服务器的连接 WmiWrapper.CreateShareNetConnect("192.168.3.210", "Temp", "wmi", "123", 5000); WmiWrapper.CopyResourceToRemote(new ManagementScope(), @"G:\Temp\NxSafeCommLog", @"\\192.168.3.210\Temp\Diag\4", false); //WmiWrapper.CopyResourceToRemote(new ManagementScope(), @"G:\Temp\Diag", @"\\192.168.3.210\Temp\Diag\3", false); }
public void Test2(ManagementScope scope) { string sharename = "BJM15ATS"; string ip = "txtIP.Text"; string username = "******"; string password = "******"; string folder = "txtRemoteFolder.Text"; if (scope.IsConnected) { WmiWrapper.CreateShareNetFolder(scope, folder, sharename, "BJM15-ATS Software Folder"); WmiWrapper.RemoveShareNetConnect(ip, sharename, username, password); WmiWrapper.CreateShareNetConnect(ip, sharename, username, password, 5000); Process.Start("explorer", @"\\" + ip + @"\" + sharename); //WmiWrapper.RemoveShareNetFolder(scope, sharename); } }