%username% variable in homepage URL through Group Policy

We have a SharePoint 2010 site that has individually customized pages (dashboards) for each user. The URL to each user's dashboard contains their Active Directory username. The URL for a dashboard would be as follows: sharepoint/dashboards/USERNAME. I'm trying to figure out a way to use Group Policy or other means to force everyone's homepage to their dashboard by default. I'm unable to do this through Group Policy by going to User Configuration > Administrative Templates > Windows Components > Internet Explorer and setting "Disable changing homepage settings" to sharepoint/dashboards/%username%. Internet Explorer doesn't seem to accept and translate that variable when it comes from Group Policy. However, creating a shortcut file with sharepoint/dashboards/%username% does work.

Would anyone know how to achieve this? Any help would be greatly appreciated.



  • Edited by kwinslow12 Wednesday, August 19, 2015 4:42 PM spacing
  • Changed type kwinslow12 Wednesday, August 19, 2015 9:07 PM
August 19th, 2015 4:42pm

Simply add %username% into Group Policy will not work. Probably, translate this with some scripts prior to generating the URL, then deploy it via Group Policy at each user log on with a logon script. Just some thoughts.
 
Check if this thread helps:
 
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/78b1ebc7-c22d-49e1-9ebf-a788baca6844/pass-username-variable-in-url
 
Also, if you have any question about scripts, you can post in the dedicated scripting forum below:
 
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
 

Regards,

Eth

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 7:02am

Group Policy Preferences can perform variable resolution/expansion for you.

The GPP variable you want is probably %LogonUser%

https://technet.microsoft.com/en-us/library/cc753915.aspx

August 24th, 2015 7:28am

I ended up writing a VBScript file which does work. I was just hoping there would be a simpler way. I included the script below. However, it isn't being enforced when I set it through the Local Group Policy Editor on my computer as a test. I went to User Configuration > Scripts > Logon within Group Policy Editor.

Option Explicit

Dim objSysInfo, objNetwork, objUser, wshNetwork
Dim wshShell, url, regKey
Dim adoCommand, adoConnection
Dim objGroupList, oshell, WshSysenv
Dim strAttributes
Dim strUsername
Dim strBase
Dim sUsername

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

sUsername = objNetwork.UserName

Set wshNetwork = CreateObject( "WScript.Network" )
strUserName = wshNetwork.UserName
 
Set wshShell = CreateObject("WScript.Shell")
url = "sharepoint/pages/" & strUsername
regKey = "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page"
wshShell.RegWrite regKey, url, "REG_SZ"
If Err.Number <> 0 Then
WScript.Quit
End If
On Error Goto 0

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 4:41pm

Thank you for sharing your script here. It will be very beneficial for other community members who have similar questions.
 

Regards,

Eth

August 26th, 2015 11:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics