S
SimonH
Hi guys would love your help.
I have the following....
=================================================================
#use Win32:rocess;
use Win32::Registry;
open (INPUT,"machines.txt") or die "cant open machine.txt";
@computers = <INPUT>;
while (<INPUT>){
chomp;
push @computers, $_;
}
foreach $computer(@computers) {
print "Connecting to ....... $computer\n";
$rc = system ("net use \\\\$computer\\ipc\$ /user:domain\\user
password> NUL");
if ($rc ==0){ # If the connection succeeds
print "Connected to $computer\n";
QueryAutoEndTasksReg;
print " AutoEndTasks = $AutoValue\n";
}
elsif (!rc ==0) { # If
the connection fails......
print "Failed to connect to $computer\n\n";
}
}
sub QueryAutoEndTasksReg {
$p = '.DEFAULT\Control Panel\Desktop';
Win32::RegOpenKeyEx(&HKEY_USERS,$p,&NULL,&KEY_ALL_ACCESS,$hkey);
Win32::RegQueryValueEx($hkey,"AutoEndTasks",&NULL,$type,$AutoValue);
# Win32::RegCloseKey($hkey);
}
================================================================= Output at
the moment is this...
C:\Test>test.pl
Connecting to ....... machine1
The command completed successfully.
Connected to machine1
AutoEndTasks =
Connecting to ....... machine2
System error 53 has occurred.
The network path was not found.
Failed to connect ot machine2
Connecting to ....... machine3
The command completed successfully.
Connected to machine3
AutoEndTasks =
C:\Test>
=====================================================
What Im trying to do is query the following registry string VALUE
AutoEndTasks on all systems in a machine.txt file...
HKEY_USERS\.DEFAULT\Control Panel\Desktop\AutoEndTasks
I have a feeling I have the format wrong in my sub..
sub QueryAutoEndTasksReg {
$p = '.DEFAULT\Control Panel\Desktop';
Win32::RegOpenKeyEx(&HKEY_USERS,$p,&NULL,&KEY_ALL_ACCESS,$hkey);
Win32::RegQueryValueEx($hkey,"AutoEndTasks",&NULL,$type,$AutoValue);
#Im not sure if I have this correct.
# Win32::RegCloseKey($hkey);
}
If someone could offer some advice, that would be great.
Thank you.
S
I have the following....
=================================================================
#use Win32:rocess;
use Win32::Registry;
open (INPUT,"machines.txt") or die "cant open machine.txt";
@computers = <INPUT>;
while (<INPUT>){
chomp;
push @computers, $_;
}
foreach $computer(@computers) {
print "Connecting to ....... $computer\n";
$rc = system ("net use \\\\$computer\\ipc\$ /user:domain\\user
password> NUL");
if ($rc ==0){ # If the connection succeeds
print "Connected to $computer\n";
QueryAutoEndTasksReg;
print " AutoEndTasks = $AutoValue\n";
}
elsif (!rc ==0) { # If
the connection fails......
print "Failed to connect to $computer\n\n";
}
}
sub QueryAutoEndTasksReg {
$p = '.DEFAULT\Control Panel\Desktop';
Win32::RegOpenKeyEx(&HKEY_USERS,$p,&NULL,&KEY_ALL_ACCESS,$hkey);
Win32::RegQueryValueEx($hkey,"AutoEndTasks",&NULL,$type,$AutoValue);
# Win32::RegCloseKey($hkey);
}
================================================================= Output at
the moment is this...
C:\Test>test.pl
Connecting to ....... machine1
The command completed successfully.
Connected to machine1
AutoEndTasks =
Connecting to ....... machine2
System error 53 has occurred.
The network path was not found.
Failed to connect ot machine2
Connecting to ....... machine3
The command completed successfully.
Connected to machine3
AutoEndTasks =
C:\Test>
=====================================================
What Im trying to do is query the following registry string VALUE
AutoEndTasks on all systems in a machine.txt file...
HKEY_USERS\.DEFAULT\Control Panel\Desktop\AutoEndTasks
I have a feeling I have the format wrong in my sub..
sub QueryAutoEndTasksReg {
$p = '.DEFAULT\Control Panel\Desktop';
Win32::RegOpenKeyEx(&HKEY_USERS,$p,&NULL,&KEY_ALL_ACCESS,$hkey);
Win32::RegQueryValueEx($hkey,"AutoEndTasks",&NULL,$type,$AutoValue);
#Im not sure if I have this correct.
# Win32::RegCloseKey($hkey);
}
If someone could offer some advice, that would be great.
Thank you.
S