当调用CreateFile()函数时,它返回错误代码0x5,这意味着访问被拒绝。任何人都可以帮助解决这个问题吗?
注意: CreateFile()读取快照的路径,文件路径为\?\globalroot\device\harddiskvolumeshadowcopy35\program files\common files\microsoft \web server extensions\12\CreateFile and。
非常感谢。
发布于 2011-04-07 08:44:50
ConnectionOptions connection = new ConnectionOptions();
//just username, without domain name, otherwise, a "RPC is Unavaliable." exception will be thrown.
connection.Username = "testUser";
connection.Password = "testPassword";
//Allow privilege
connection.EnablePrivileges = true;
connection.Impersonation = ImpersonationLevel.Delegate;
connection.Authentication = AuthenticationLevel.Call;
//Neither ntdlmdomain or kerberoes, otherwise, a "Invalid Parameter." exception will be thrown.
connection.Authority = "ntlmdomain:MYDOMAIN";
//IP Address or host full name.
ManagementScope scope = new ManagementScope("\\\\myIPAddress\\root\\CIMV2", connection);
scope.Connect();
ManagementClass classInstance = new ManagementClass(scope,new ManagementPath("Win32_Process"), null);
ManagementBaseObject inParams = classInstance.GetMethodParameters("Create");
//Change it to your own execute file path
inParams["CommandLine"] = "myExecuteFilePath";
ManagementBaseObject outParams = classInstance.InvokeMethod("Create", inParams, null);发布于 2011-04-01 17:18:40
您可以手动创建该文件吗?这很可能是权限问题。
发布于 2011-04-01 17:19:03
这意味着您没有足够的权限读取此文件。检查文件权限。
https://stackoverflow.com/questions/5511367
复制相似问题