Jump to content

Recommended Posts

Posted (edited)

Hi

 

I want to re-direct the favourites to a folder in the users home folder. In the registry I can find where to do it “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders” then “Favourites”.

 

How would I change this in a VBS script? Would it be a start-up or logon please?

 

Cheers

Edited by FN-Greatermanchester
Posted
It would be to change the user environment so it would be a log on script. There are plenty of examples on the MS Script Centre you can adapt for your needs.
Posted (edited)
But would users have security rights to change registry settings? Edited by FN-Greatermanchester
Posted

using this code:

 

Option Explicit

' Variable Declarations
Dim objShell
Dim objNetwork
Dim strUserName
Dim strRegKey
Dim strRedirectionPath

' Variable Initilisations
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
strUserName = objNetwork.UserName
strRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites"
strRedirectionPath = "%homedrive%\Favorites"

' Write the new Favorites path
objShell.RegWrite strRegKey, strRedirectionPath

' Variable Destruction
Set objShell = Nothing
Set objNetwork = Nothing

' Quit
WScript.Quit

 

It alters the registry so thats all good.

 

But when i try to view the favourites its all greyed out. The folder does exist in the users home drive but it jsut doesn't want to work.

 

any ideas please?

Posted (edited)
You cant just use an environment variable in VB such as %homedir% you must expand it first. There is a command to do this. Edited by ChrisH
Posted

dont forget if you redirect for all your users it adds a massive load to the server to have all those connections, an alternative is to add custom ones via group policy or by copying to the users logon profile folder.

 

or have them locally and redirect all users to the local copy.

 

we do this here with the startmenu, its redirected to c:\profile\startmenu and can be updated with a robocopy script to copy the files to all of the computers in a room.

 

works here

 

hth

Posted
You cant just use an environment variable in VB such as %homedir% you must expand it first. There is a command to do this.

 

I’m not a VB expert here so please bare with me. Why not? It seems to have done the trick on the registry settings and all the other settings of this nature use those variables.

 

dont forget if you redirect for all your users it adds a massive load to the server to have all those connections, an alternative is to add custom ones via group policy or by copying to the users logon profile folder.

 

or have them locally and redirect all users to the local copy.

 

we do this here with the startmenu, its redirected to c:\profile\startmenu and can be updated with a robocopy script to copy the files to all of the computers in a room.

 

works here

 

hth

 

Thanks an idea thanks, but i haven't got my head arround robocopy yet

Posted

It's not that VBScript doesn't understand environment variables; it's whether the registry key is REG_SZ or REG_EXPAND_SZ.

 

User Shell Folders does use REG_EXPAND_SZ so you should be able to use the env var - we use:

oShell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites","%homeshare%\favorites","REG_EXPAND_SZ"

and it works fine.

 

Can't see any reason why having a connection to a server will cause a problem - even if the users are reading the entire tree every few minutes they're all tiny files so you're hardly going to stress things out. If you put the favorites as a sub folder under the home drive then they've already got a connection to the server for that.

Posted

We don't use a script, I have a ADM for Group Policy..... call it iefavsloc.adm and import it in to a object.... hey presto!

 

CLASS USER

CATEGORY !!WindowsComponents

CATEGORY !!InternetExplorer

CATEGORY !!IE_Favorites

KEYNAME "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"

 

POLICY !!IE_Favorites

#if version >= 4

SUPPORTED !!SUPPORTED_IE5

#endif

 

EXPLAIN !!IE_Favorites_Location_Explain

 

PART !!IE_Favorites_Location_Tip1 TEXT

END PART

 

PART !!IE_Favorites_Location EDITTEXT EXPANDABLETEXT

VALUENAME Favorites

DEFAULT "%USERPROFILE%\Favorites"

REQUIRED

END PART

END POLICY

 

END CATEGORY ;; IE_Favorites

END CATEGORY ;; Internet Explorer

END CATEGORY ;; WindowsComponents

 

 

[strings]

 

WindowsComponents="Windows Components"

IE_Favorites="Favorites"

IE_Favorites_Location="The path to the favorites folder"

IE_Favorites_Location_Explain="Specify the path to the location of favorites. You can use variables like %USERPROFILE%, %USERNAME%, etc... Both local and UNC paths are valid."

IE_Favorites_Location_Tip1="Specify the UNC path to the favorites location"

InternetExplorer="Internet Explorer"

SUPPORTED_IE5="at least Internet Explorer v5.01"

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...