BELOW IS ONE OF THE CODE IN VB.NET FOR NIDS:


private void Read_Shared_Folder(string ip,string uname,string pass,bool cb)
{
int cnt = 0;
try
{
///string ssWmiMachine1 = "\\\\" + "192.168.1.10" + "\\root\\cimv2";
// MQL for Shaer Information
if(cb)
ip = System.Environment.MachineName;

if (!cb)
{
co = new ConnectionOptions();
co.EnablePrivileges = true;
co.Username = uname;
co.Password = pass;
co.Impersonation = System.Management.ImpersonationLevel.Impersonate;
}

string ssWmiMachine = "\\\\" + ip + "\\root\\cimv2";

ms = new ManagementScope(ssWmiMachine, co);

oq2 = new ObjectQuery("SELECT * FROM Win32_Share");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms,oq2);

foreach (ManagementObject queryObj in searcher.Get())
{
RDirPath = queryObj["Path"].ToString();
if (!RDirPath.Equals("") || RDirPath.Equals("IPC$") || RDirPath.Equals("ADMIN$"))
{
File_Watcher(RDirPath);
}
load_Shared_Item(cnt, queryObj["Name"].ToString(), queryObj["Path"].ToString(),

queryObj["Description"].ToString(), queryObj["Status"].ToString());
cnt = cnt + 1;

}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}
}


WHEN I EXECUTE THE CODE I AM GETTING AN ERROR MESSAGE:

An error occurred while querying for WMI data: Access Denied

PLS HOW DO I GAIN ACCESS TO THE WMI data....