两台机器共享文件操作
来源:互联网 发布:儿童编程入门pdf 编辑:程序博客网 时间:2024/05/16 05:27
先使用Wmi开通连接,再操作文件
using System;
using System.Management;
// This example demonstrates how to connect to remote machine
// using supplied credentials.
class Sample_ConnectionOptions
{
public static int Main(string[] args) {
ConnectionOptions options = new ConnectionOptions();
options.Username = UserName; //could be in domain\user format
options.Password = SecurelyStoredPassword;
ManagementScope scope = new ManagementScope(
\\\\servername\\root\\cimv2,
options);
try {
scope.Connect();
ManagementObject disk = new ManagementObject(
scope,
new ManagementPath("Win32_logicaldisk= 'c: '"),
null);
disk.Get();
}
catch (Exception e) {
Console.WriteLine("Failed to connect: " + e.Message);
}
return 0;
}
}
{
try
{
string server= "\\\\10.88.60.88 ";
string UserName= "MyMachine\Administrator ";
string Pass= "mypass ";
ConnectionOptions options = new ConnectionOptions();
options.Username = UserName; //格式:机器名或所在域名
options.Password = Pass; //对应的密码
ManagementScope scope = new ManagementScope(server,options);
try
{
scope.Connect();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
- 两台机器共享文件操作
- 两台主机共享文件
- 两台mac共享文件
- 两台机器共享上网问题
- 两台Ubuntu主机共享文件
- 两台电脑怎么共享文件
- 两台windows电脑共享文件技巧
- 两台Linux机器实现文件交换
- Linux 两台机器互拷文件
- Linux 两台机器互拷文件
- centos两台机器文件同步
- 打通两台机器
- 使用路由器实现两台电脑共享文件的方法
- [整理]Windows 与 Ubuntu 两台电脑间共享文件
- 两台windows笔记本创建家庭组实现文件共享
- 同一个局域网的两台电脑实现文件共享
- 两台win10电脑连接同一个wifi怎么共享文件
- 怎样快速实现两台电脑硬盘文件共享?
- Android SDK源码安装教程
- 对含有bean的list按照汉字排序
- 从敏捷的业务目标论软件开发
- Refactoring Memo
- Ftp在Windows下的客户端工具
- 两台机器共享文件操作
- 与python第一次亲密接触
- 中国联通推“薄膜卡”方案:可实现一卡双号
- Asp.net CKeditor+CKfinder(html編輯器)
- JS柱状图
- JAVA中使用Vector
- MySQL 学习记录
- 如何获取app access_token(针对这样的错误This method must be called with an app access_token.)
- JBPM5学习笔记