Sign in to follow this  
Followers 0
rich2323

Deleting remote registry key

3 posts in this topic

I am trying to remotely remove a HKU registry key.

I can delete values in the same branch, but can't delete the actual key.

I also can delete the key if I use the registry editor (connecting remotely)

Here is an example of the registry key exported:

Windows Registry Editor Version 5.00
[HKEY_USERS\S-1-5-21-1400463981-1064451746-3237261625-5047\Software\Act\OutlookAddressBooks]
[HKEY_USERS\S-1-5-21-1400463981-1064451746-3237261625-5047\Software\Act\OutlookAddressBooks\2]
"padFile"=""
"Password"="F180D8541454E04F8C1EC942F86A588B"
"User"=""

Here is the code I use to delete "padFile" from OutlookAddressBooks\2

$delete = RegDelete ("\\192.168.16.101\HKU\S-1-5-21-1400463981-1064451746-3237261625-5047\Software\Act\OutlookAddressBooks\2","PadFile")

This code works correctly and deletes the value.

Here is the code I am trying to use to delete OutlookAddressBooks\2:

$delete = RegDelete ("\\192.168.16.101\HKU\S-1-5-21-1400463981-1064451746-3237261625-5047\Software\Act\OutlookAddressBooks\2")

When I run this code I get a return code of "2" and an @error code of "-2" and an extended error code of "1745"

Am I doing something wrong in my code?

Is there a better way to delete this remotely?

Thanks for your help,

Rich

Share this post


Link to post
Share on other sites



Let's look at that error: RPC_S_PROCNUM_OUT_OF_RANGE

http://msdn.microsoft.com/en-us/library/cc245518%28v=prot.13%29.aspx

Similar problem with C#:

http://stackoverflow.com/questions/6779803/c-sharp-cant-delete-certificate-from-remote-machine

Concerning some different type of function, a normal behaviour for something or other says this:

Windows NT 4.0 SP3 does not support this method and returns 0x000006D1 (RPC_S_PROCNUM_OUT_OF_RANGE).

Which leads me to believe that the method you are using is not supported by the OS you are trying it on.... such as XP...

Look at this thread on Social:

http://social.msdn.microsoft.com/Forums/en/netfxbcl/thread/c1d73bfc-ab61-4e35-8f9b-8456f1ca66fd

Share this post


Link to post
Share on other sites

Thanks Triprdacus, I was banging my head on this one and could not figure it out. I'll start working on plan B.

I really appreciate that you help explain why it does not work, rather than just leaving it hanging out there. It’s nice to have closure.

Rich

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0