Tag: 远程服务器

在远程计算机上运行命令

我想在使用C#的远程计算机上的命令提示符下运行命令。 根据此链接如何在远程计算机中执行命令? ,我试图使用以下代码执行此操作: public static void RunRemoteCommand(string command, string RemoteMachineName) { ManagementScope WMIscope = new ManagementScope( String.Format(“\\\\{0}\\root\\cimv2”, RemoteMachineName)); WMIscope.Connect(); ManagementClass WMIprocess = new ManagementClass( WMIscope, new ManagementPath(“Win32_Process”), new ObjectGetOptions()); object[] process = { command }; object result = WMIprocess.InvokeMethod(“Create”, process); Log.Comment(“Creation of process returned: ” + result); } 这将返回退出代码0并且不会抛出任何错误,但不会执行任何操作。 请帮忙。

用于C#的远程SQL服务器的正确连接字符串

我只想知道远程sql server express版本的正确sql连接字符串。 这是我得到的,但我遇到了一些问题 SqlConnection cs = new SqlConnection(@”Data Source=(IP Address)\PC-NAME\SQLEXPRESS,1433;Network Library=DBMSSOCN;Initial Catalog=dbase;User ID=sa;Password=password”); 我在C#调试器中遇到了这个错误: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: […]