Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Problem connecting the remote machine in using TieRegistry.

by pradeep,krishna (Scribe)
on Apr 03, 2014 at 10:01 UTC ( #1080916=perlquestion: print w/ replies, xml ) Need Help??
pradeep,krishna has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellow monks.
I am new to this TieRegistry module.
The main intention of my scripting now is to:
-> Copy a registry value of the remote server,
-> Delete that entry in the same server and,
-> Write it again after performing some function in the server.

To start with it, as a test script I created the following script:

use Win32::TieRegistry(Delimiter => "/", ArrayValues => 0); $host = "myserver.com"; $remKey= $Registry->Connect($host,"LMachine/",{ Access=>KEY_READ, Deli +miter=>"/" } ); $remoteKey = $Registry->{"//$host/LMachine/SOFTWARE/Microsoft/Windows +NT/CurrentVersion/ProductName"} or die "Can't read from $host. Error: + $^E\n"; print "$remoteKey\n";
When I compile this code I am getting the erred output saying :Can't read from ilbtdb1.jdadelivers.com. Error: The handle is invalid

help me in solving this.
Thanks in advance.

Comment on Problem connecting the remote machine in using TieRegistry.
Download Code
Re: Problem connecting the remote machine in using TieRegistry.
by pradeep,krishna (Scribe) on Apr 03, 2014 at 10:15 UTC

    I had missed to connect to the server. Now i made changes to my code as bellow:

    use Win32::TieRegistry(Delimiter => "/", ArrayValues => 0); $host = "myserver.com"; $password='password'; $domain='myserver'; $login = 'my_admin'; $op=`net use \\\\$host\\ipc\$ \"$password\" \/user:$domain\\$login`; $remoteKey = $Registry->{"//$host/LMachine/SOFTWARE/Microsoft/Windows +NT/CurrentVersion/ProductName"} or die "Can't read from $host. Error: + $^E\n"; print "$remoteKey\n";
    Now I am getting the perfect output.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1080916]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2014-09-19 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls