Update IE Favorite for all users in Windows 7

Posted on 2014-08-19
Last Modified: 2014-08-19
Does anyone know of a way to try and accomplish this?

Basically, I'm trying to make a script that when deployed to the computer, it will scan through the local C-Drive for any shortcut type of file called "VPN" which would most likely have the extension .url (the extension/format of an Internet Explorer favorite shortcut).

Then how can the script delete that .url and replace it with another shortcut ("New VPN.url" from a network share?

With PowerShell, I've got this so far:
Get-ChildItem C:\Users -Recurse | ? {$_.Name -like "*VPN*"}

But not sure if Powershell is the way to go and what to pipe this to, or, if maybe batch script is a better way to go which I'm not very familiar with.
Question by:garryshape
    LVL 38

    Expert Comment

    For deploying a URL I'd go with Group Policy Preferences.  Get rid of the existing one, then deploy a new shortcut with GPP.  It's then easy to update it at any time.

    Author Comment

    I think some people have the favorite stored in difference places though, like c:\users\%username%\favorites or sub-folder "Favorites bar", as well as maybe on their Desktop folder.

    As for Group Policy, what could that do for me here as far as deleting old ones and adding a new one? Would it interfere with their other shortcuts, or make everyone have completely identical Favorites all together?

    Author Comment

    So maybe I can do something like:

    $shortcuts = Get-ChildItem C:\Users -Recurse | where {$_.Name -like "*VPN*.url"}

    Then how can you replace each file with another file
    LVL 38

    Accepted Solution

    And that's one area where I would standardize.  You can deploy a shortcut (like on the Desktop), or you can deploy a Favorite, or both if really need be.  As far as deleting old ones (or modifying existing ones), GP may not help here, but you could try the "Update" action (I haven't played around with modifying an existing shortcut/Favorite that wasn't created by GP).  But deploying, and then subsequently updating, would be a snap.  It wouldn't interfere with any existing Favorites.  You may check this out for an example of using this.

    You may just want to use a script like your line above and just delete each match, then use GPP to create the new one.

    Author Closing Comment

    Ok thanks, makes sense. delete with script then standardize with GP. best way to go . thanks

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
    Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now