sathish_raos
asked on
how do solve access denied error code 0x80070005?
Hi all
using System;
using System.Collections;
using System.Collections.Generic
using System.Runtime.InteropServ
using System.Text;
using System.IO;
using System.Net;
using System.Management;
using System.Diagnostics;
public class Program
{
static void Main(string[ ] args)
{
string[] arr = { "10.10.10.53" };//,"10.10.10.10","10.10.
for (int index = 0; index < arr.Length; index++)
{
ConnectionOptions connOptions = new ConnectionOptions();
connOptions.Username = "jaMochaHQ\adstest";
connOptions.Password = "adstest321";
ManagementScope scope = new ManagementScope(("\\\\" + arr[index] + "\\root\\cimv2"), connOptions);
//scope.Connect();
//scope.Options.EnablePriv
//scope.Options.Impersonat
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(s
try
{
ManagementObjectCollection
foreach (ManagementObject m in queryCollection)
{
Console.WriteLine("Compute
Console.WriteLine("Windows
}
}
catch (Exception exp)
{
Console.WriteLine("Excepti
}
}
Console.WriteLine("done");
Console.ReadKey();
}
}
i have posted the code in which i'm try to access remote computers where i need to get client machine name as well as the windows directory which returns me ACCESS DENIED ERROR CODE 0x80070005 when ever i execute it i have been logged in as domain administrator but still i'm not able to connect it can anyone help me out with this problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the reply.
But still i'm getting the exception as :Exception while querying 10.10.10.53.Exception is invalid parameter. can anyone help me out.
Thanks,
But still i'm getting the exception as :Exception while querying 10.10.10.53.Exception is invalid parameter. can anyone help me out.
Thanks,
You might change the csname to Csname.
ASKER
thank you for the replay but the error is still the same :Exception while querying 10.10.10.53.Exception is invalid parameter. can anyone help me out
thanks
thanks
Ok so the problem is different now, correct? No longer a access denied?
connOptions.Username = "jaMochaHQ\adstest";
connOptions.Password = "adstest321";
I don't "write code" but this is what looks like is happening to me.