ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
Internet Explorer Settings
by other posts by this author
Feb 27 2004 6:01PM messages near this date
Socket Issues After Install | RE: Help Needed : JComboBox and Table (Tk)
Hi All,

Is there a way to pre-configure Internet Explorer Proxy settings and home 
page address for all users on a Windows machine?  Even those users who are 
logging in for the first time?  I tried to setup Internet Explorer via 
Registry but for some reason, the settings are not being used for users 
who logged in for the first time.  The script is intended for setting up a 
new machine for a user, post configuration details.

Do you guys have any alternative, can this be done using WMI?

I have the following code:

#Set Proxy
my $path_proxy = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet 
Settings";
my $value_proxy = 'AutoConfigURL';
my $proxy = 'http://proxy.acme.com';
set_ie($path_proxy,$value_proxy,$proxy);
 
#Set HomePage
my $path_homepage = "Software\\Microsoft\\Internet Explorer\\Main";
my $value_homepage = 'Start Page';
my $homepage = 'http://homepage.net';
set_ie($path_homepage,$value_homepage,$homepage);

sub set_ie
{
    my ($path,$value,$data) = @_;
    my $flag = 0;
 
    $HKEY_USERS-> Open("", my $main_key);
    my @keylist;
    $main_key-> GetKeys( \@keylist );
 
    foreach (@keylist)
    {
       if ($main::HKEY_USERS-> Open("$_\\$path", my $key))
       {
            unless ($key-> SetValueEx($value, 0, REG_SZ, $data))
            {
                $flag++;
            }
       }
    }
 
    if ($HKEY_LOCAL_MACHINE-> Open($path, my $root))
    {
        unless ($root-> SetValueEx($value, 0, REG_SZ, $data))
        {
            $flag++;
        }
    }
 
    if ($HKEY_CURRENT_USER-> Open($path, my $root))
    {
        unless ($root-> SetValueEx($value, 0, REG_SZ, $data))
        {
            $flag++;
        }
    }
 
    unless ($flag)
    {
        record_log("Set $value to $data\n",0);
    }
    else
    {
        record_log("Not able to set $value to $data: $!\n",1);
    }
}

Regards,
Sam Dela Cruz

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved