# Kod okrela maksymalny rozmiar rejestru systemu Windows 2000 Server

use Win32::OLE;
$Win32::OLE::Warn = 3;

# ------ KONFIGURACJA SKRYPTU ------
$intValue = '<RozmiarWBajtach>'; # np. 104857600 (rozmiar rejestru w bajtach)
$strComputer = '<NazwaSerwera>'; # np. server01 (w przypadku lokalnego serwera naley uy kropki)
# ------ KONIEC KONFIGURACJI ---------
use constant HKLM => 0x80000002;
$strKeyPath = 'System\\CurrentControlSet\\Control';
$strValueName = 'RegistrySizeLimit';
$objReg = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\default:StdRegProv');
$intRC = $objReg->SetDwordValue(HKLM, $strKeyPath, $strValueName, $intValue);
if ($intRC != 0) {
    print 'Podczas ustawiania wartoci wystpi bd: ' . $intRC, "\n";
}
else {
    print "Z powodzeniem ustawiono rozmiar $strValueName\n";
}
