*** From dhcp-server -- To unsubscribe, see the end of this message. ***

On Thu, 3 Feb 2000, Rolen, Mark E. wrote:

>    *** From dhcp-server -- To unsubscribe, see the end of this message. ***
> 
> By the way, if anyone has a smoother, even less intrusive way to do this
> reghack (it *IS* far faster than doing it manually), I'd be curious to learn
> it   :)


Perl is your friend, I run the following in our nt login scripts it should
give you some idea of how to use perl for making registry changes.

# First outline user hack script
# to do:- get OS details, user details, build database of installed
# patches etc...in fact lots :)

use strict;
use Win32::Registry qw( REG_SZ REG_DWORD );
use Win32;

my $installedpatches="SOFTWARE\\COEPatches\\InstalledPatches";
my $waitfor="_INS5576._MP";
my $failedpatches="SOFTWARE\\COEPatches\\FailedPatches";
my $Software;
my $InstalledPatches;
my $Coepatches;
my $FailedPatches;
my $currentpatch;
my $newpatch;
my $newfiles;
my $CoePatches;
my $currenttime;
my $HKCU;
my $HKLM;
my $hostname;
my $username;
my $Domain;
my $SID;
my $SIDtype;

$main::HKEY_CURRENT_USER->Open("SOFTWARE", $Software) or die "Open: $! "; 
$main::HKEY_CURRENT_USER->Open($installedpatches,$InstalledPatches); 
                                 
if($InstalledPatches) {
        print("Registry Entry for Patches exists\n");
}else {
        print ("Creating Registry entries to hold patch information\n");
        $Software->Create("CoePatches", $CoePatches) or die "Create: $!";
        $CoePatches->Create("InstalledPatches",$InstalledPatches) or die "Create: $1";
        $CoePatches->Create("FailedPatches", $FailedPatches) or die "Create: $1"; 
}
my $installtime;
my $patchno="undefined";
my $os=$ENV{"OS"};
print "os found $os\n";
my $NT="Windows_NT";
my $hostname=$ENV{"COMPUTERNAME"};
my $username=$ENV{"USERNAME"};

#Why does notepad do wierd things with the || bit in this?
open (PATCHID,"patchid") or die "oops...what patch am I supposed to be$!"; 
#�� die "cannot open PATCHID\nIs patch.pl being run from it's own directory?\n";
$patchno= <PATCHID>;
chomp($patchno);
$InstalledPatches->Open($patchno,$currentpatch);

if ( $currentpatch) {
        printf("Patch $patchno is already installed\n");
}
else {
        my $wait=1;
        printf("Installing patch $patchno\nPlease wait\n");
        
        if ( $os eq $NT) {
#Registry Hack to do filename completion
                $main::HKEY_CURRENT_USER->Open("SOFTWARE\\Microsoft\\Command 
Processor", $HKCU) or die "Open: $! ";
                $HKCU->SetValueEx("CompletionChar",0,REG_DWORD,0x09);

#Registry Hack to turn off drive letters
                
$main::HKEY_CURRENT_USER->Open("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
 $HKCU) or die "Open: $! ";
                $HKCU->SetValueEx("NODRIVES",0,REG_DWORD,24);

#Registry hack to force hung tasks to end when logging off
                $main::HKEY_CURRENT_USER->Open("Control Panel\\Desktop", $HKCU) or die 
"Open: $! ";
                $HKCU->SetValueEx("AutoEndTasks",0,REG_SZ,1);
                $HKCU->SetValueEx("WaitToKillAppTimeout",0,REG_SZ,10000);


                
                print"Doing Postconfig\n";
                system(".\\postinst.pl");
        }
        else {
               
        }
        
        
        if ( $os eq $NT) {  
                printf("Installing services.....\n");
                
                
        }
        $installtime=localtime;
        
        
        print "\n$currenttime";
        $InstalledPatches->Create($patchno,$newpatch) or die "horribly $!";
        $newpatch->Create("NewFiles", $newfiles) or die "horribly $!";
        $newpatch->SetValueEx("Installdate",0,REG_SZ, $installtime);
        
}




-------------------------------------------------------------------------------
| Iain Rae               | Tel: 0131 449 5111 Ext 4406 (Day)(but I'm never in)|
| Computing Officer.     | Any Opinions I am able to form are my own and in no|
| Civil & Offshore Eng.  | way reflect those of my employers.                 |
| Heriot-Watt University.| Well that's my opinion anyway.                     |
-------------------------------------------------------------------------------



-----------------------------------------------------------------------
List Archives : http://www.isc.org/ml-archives/dhcp-server/
Unsubscribe   : http://www.isc.org/dhcp-lists.html    
-or-          : mailto:[EMAIL PROTECTED]?Subject�subscribe  
-----------------------------------------------------------------------

Reply via email to