URGENT! Changing IE PAC Settings with Python

Tim Golden mail at timgolden.me.uk
Wed May 20 23:11:58 CEST 2009

K-Dawg wrote:
> Thanks for any response.  I am in a crisis where one of our networking guys
> moved where our PAC file is housed.  There was a group policy set in Active
> Directory that set the PAC file location in Internet Explorer to the new
> location.
> However, we have 100 remote centers that have about 3 to 4 machines that are
> not on AD (from before an AD migration).  These machines did not receive the
> update.
> Is there a way I can write a python script to run from my machine to jump
> out to a list

More of a Windows question, really, and depends on the configuration
of network, security etc. Certainly you can use any of the usual
Windows techniques (UNCs, WMI, DCOM etc.) to invoke things on those remote
machines, assuming you have enough network and credentials to get there.

Not clear what your level of expertise is, either at the Windows
or at the Python level, so apols. if suggesting the obvious here.
If you already know what technique you're going to use to push
your file out (say, a copy to a remote unc) then getting Python to
read a list of machines from a file and doing the same to each one
is child's play:

import shutil
for machine in open ("machines.txt"):
  shutil.copyfile ("local.pac", r"\\%s\c$\somewhere\thing.pac" % machine)

If you need to set up credentials for that connection first, you
might want to use the win32net module from the pywin32 extensions
to establish a mapped drive or at least a NULL session with known

As a possibility the other way round, if you're able to WMI into
the machines, you could run a command on them to pull the file
in, rather than pushing. Obviously, you've still got to establish

I'll stop there, because I might be missing the target altogether.
You'll certainly get help here, but you might want to post to
the python-win32 list which is a bit more specialised.


More information about the Python-list mailing list