Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automate the modifying of IE8 favorites

Status
Not open for further replies.

BackAche

MIS
Oct 14, 2011
1
GB
Hi,

We are soon to be doing a server move of our intranet content from one server to another whilst the old server is rebuilt.

This is going to be painfull as our 1500 users are used to going to the intranet using the servers name.

So I want to do is instead have them refer to the server via a friendly DNS name so that now and in the future we can move content from server to server and just change the DNS record.

Herein lies the problem, whilst I can change their homepages via GPO their IE8 favorites will still have the old name.

It should be as easy as having a login script trawl through the .url files and modify the server names inside but I can't help but think it's going to be more complicated than that.

Has anyone tried to do this before?
 
Is there currently a logon script being used? If so, a modification like this can easily be done via the logon script.
You can access user profile favorite via "C:\Documents and Settings\username\favorites". This path will also work if the client is using Windows 7. Replace the file with one you made.

(assuming this will be a part of the already implemented login script. If the file is burried somewhere in a subfolder, you'll want to find the file recursively)

Code:
set objFSO = CreateObject("Scripting.FileSystemObject")
set objNetwork = CreateObject("WScript.Network")

strFavorites = "C:\documents and settings\" & objNetwork.Username & "\favorites"
set objFiles = objFSO.GetFolder(strFavorites).Files

function searchDir(strDir, strQuery)
	set objFolder = objFSO.GetFolder(strDir)
	for each objSubFolder in objFolder.SubFolders
		strResults = strResults & searchDir(objSubFolder.Path, strQuery)
	next
	
	for each objFile in objFolder.Files
		if (inStr(objFile.Name, strQuery)) then strResults = strResults & objFile.Path & vbNewLine
	next

	searchDir = strResults
end function

arrFiles = split(searchDir(strFavorites, "filename.url"), vbNewLine)

for i = 0 to ubound(arrFiles)
   strFile = arrFiles(i)
   objFSO.CopyFile "NewFile.url", strFile, true
next

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top