Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

RegistryKey.OpenRemoteBaseKey Method with Hy

$
0
0

Hello. 
I'm developing a script to connect to the registry of a remote computer, as the excerpt below.

param 
([String]$computer)
$sKeyA = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$type = [Microsoft.Win32.RegistryHive]::LocalMachine
$oReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $computer)

But, the computers here at the company have a hyphen in the name (ex: 100-0223) and when I run the script passing computer parameter it shows the following error message: 

Exception calling "OpenRemoteBaseKey" with "2" argument(s): "The network path was not found."

If I run the same command on the computer that I want (locally on the target computer), the script works 

I did a test using a computer without a hyphen in the name and it worked.
Does anyone know how I can solve the case of the hyphen?

Regards
Rodrigo de Oliveira



Rodrigo de Oliveira


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>