G
Guest
I am attempting to access the following registry
HKEY_LOCAL_MACHINE\Security\Policy\PolyAdtEv using the following code. This
registry has a binary representation of the settings of the audit policies on
the remote machine. If I can read it then I can interpret it and determine
what the policies are set to. I know I have proper permissions to access
this registry. The error I am getting is that the "Object reference is not
set to an instance of the object" Please let me know what i am leaving out.
Thanks.
RegistryKey environmentKey;
string remotename;
remotename = "3dboxx-7106";
environmentKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,remotename)
.OpenSubKey("Security").OpenSubKey("Policy").OpenSubKey("PolyAdtEv");
// Print the values.
listBox1.Items.Add("There are " + environmentKey.ValueCount.ToString() +
" values for " + environmentKey.Name.ToString() + ".");
foreach(string valueName in environmentKey.GetValueNames())
{
listBox2.Items.Add(environmentKey.GetValue(valueName).ToString());
}
environmentKey.Close();
HKEY_LOCAL_MACHINE\Security\Policy\PolyAdtEv using the following code. This
registry has a binary representation of the settings of the audit policies on
the remote machine. If I can read it then I can interpret it and determine
what the policies are set to. I know I have proper permissions to access
this registry. The error I am getting is that the "Object reference is not
set to an instance of the object" Please let me know what i am leaving out.
Thanks.
RegistryKey environmentKey;
string remotename;
remotename = "3dboxx-7106";
environmentKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,remotename)
.OpenSubKey("Security").OpenSubKey("Policy").OpenSubKey("PolyAdtEv");
// Print the values.
listBox1.Items.Add("There are " + environmentKey.ValueCount.ToString() +
" values for " + environmentKey.Name.ToString() + ".");
foreach(string valueName in environmentKey.GetValueNames())
{
listBox2.Items.Add(environmentKey.GetValue(valueName).ToString());
}
environmentKey.Close();