Jump to content
Sign in to follow this  

Deleting remote registry key

Recommended Posts


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

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

$delete = RegDelete ("\\\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 ("\\\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,


Share this post

Link to post
Share on other sites

Let's look at that error: RPC_S_PROCNUM_OUT_OF_RANGE


Similar problem with C#:


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:


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.


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