Jump to content



Photo

Deleting remote registry key


  • Please log in to reply
2 replies to this topic

#1 rich2323

rich2323

    Seeker

  • Active Members
  • 34 posts

Posted 01 August 2012 - 01:01 PM

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







#2 Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Active Members
  • PipPipPipPipPipPip
  • 730 posts

Posted 02 August 2012 - 02:52 PM

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

#3 rich2323

rich2323

    Seeker

  • Active Members
  • 34 posts

Posted 05 August 2012 - 12:04 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users