fileupdater.vbs

localproxypac.png
I mentioned earlier that I’m using a loginscript to sync the pac files to the local drive, but didn’t upload it at the time. Here it is anyhow – it’s probably not the most elegant solution, nor the one with least code; but it works for me. Used with a GPO that sets the path locally, it’s a fairly flexible way of controlling internet access.

Basically, you call it like this:

fileupdater.vbs /i:input.txt /o:target.txt

The locations can be anything the vbScript FileSystemObject is able of accessing with the credentials running it – both local drives and unc-paths.

fileupdater.vbs
I also use the script to push any changes in the PAC file into the netlogon directory (runas domain admin):

C:\scripting>fileupdater.vbs /v /i:C:\conf\proxy.pac /o:\\%USERDNSDOMAIN%\netlogon\proxypriv.pac
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

output file created: 27.03.2009 11:04:17 modified: 27.03.2009 11:17:15
input file created: 16.12.2008 03:24:19 modified: 28.03.2009 14:54:51
updating file
This entry was posted in Active Directory, Group Policies, VBscript. Bookmark the permalink.

2 Responses to fileupdater.vbs

  1. Tootar says:

    Hi is it possible to run the pac as a file directly from the netlogon.
    what syntax of forward and back slashes works?
    thanks

  2. gilrim says:

    you can address the pac-file either as a local file, or as a file located on a proper webserver.
    As far as syntax for addressing it, my experience is that anything that works in the browsers address-bar will work in this case too.

    For instance, both IE and FF understands file:///c:\boot.ini, as well as file:///\\someLocalSMBserver\media\document.txt (firefox “translates” \ to /, while IE drops them – nontheless the same URi works for both browsers).

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>