Powershell Microsoft.win32.registrykey Openremotebasekey Credentials

 Posted admin
Powershell Microsoft.win32.registrykey Openremotebasekey Credentials Rating: 4,6/5 7629 reviews

Download Pocket Tanks Deluxe Full Version Free With 295 Weapons Pack| Size. Pocket Tanks is a 1-2 player computer game for Windows and Mac OS X,. Pocket tanks deluxe free download full version with 295 weapons.

I'm attempting to use powershell to access a remote registry like so:

Depending on some factors that I'm not yet able to determine I either get

Exception calling 'OpenSubKey' with '1' argument(s): 'Requested registry access is not allowed.' Radiohead live from the basement.

Or

System.UnauthorizedAccessException: Attempted to perform an unauthorized operation. at Microsoft.Win32.RegistryKey.Win32ErrorStatic(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String machineName) Download ultraman fighting evolution 3 emuparadise.

It seems pretty clear that this is because the user I'm running the powershell script as doesn't have the appropriate credentials to access the remote registry. I'd like to be able to supply a set of credentials to use for the remote registry access, but I can find no documentation anywhere of a way to do this. I'm also not clear on exactly where to specify which users are allowed to access the registry remotely.

sgibbonssgibbons

7 Answers

Just thought I'd add my answer to anyone with this problem as well. It seems there is no way to add Credentials using RemoteRegistry. You can however use WMI to query a remote registry using alternative credentials as follows:

From here you can call standard Registry methods. The below example will return the operating system.

Hope this helps someone :)

Ben TaylorBen Taylor

Are you running remote registry service? It is disabled by default and that must be causing the issue. Check the status of this service on all remote machines you are trying to access.

ravikanthravikanth

I couldn't comment directly on bentaylr's entry above, but I've taken what he contributed and added PSCredentials creation (figured out from here) to allow you to hard code credentials into the script.

Peace of mind disclaimer: Be careful when using plaintext credentials in a script. In my case, I'm using generic credentials on machines I'm launching. Depending on your case, you might consider creating an encrypted credential file to store the password in (see link above).

The credentials you use would need to be able to access the registry if you were logged into that user on the machine you are targeting.

ddncnddncn

OverloadDefinitions

try

HanselHansel

$key.OpenSubKey($subkeyName) opens the subkey in write protected mode,$key.OpenSubKey($subkeyName,$true) opens it in writable mode

Therefore after $key.OpenSubKey($subkeyName,$true) you should be able to create a new subkey or value

If you try the same thing after $key.OpenSubKey($subkeyName) you will get 'UnauthorizedAccessException'

Wolfgang KWolfgang K

Came looking for the answer to your question, but in a little googling this morning I noticed that the first parameter is a type rather than a String.. hope this helps:

pmorrisonflpmorrisonfl

I wanted to first thank all for answers above really helpful, wanted to add that you can use Get-Credential command to collect credentials without having to hard code it in your script. I have written using the above suggestions into my script the following code and query:

The above code returns all sub key names in the specified key so that I can determine installed updates other than OS which have been applied to a server. If you want to determine all collection possibilities with the $objReg variable then run:

You will see a list of all possible queries which can be performed against the registry. Hope this helps!

user5790768user5790768

Not the answer you're looking for? Browse other questions tagged powershellregistry.netpermissions or ask your own question.