Launch URL Depending on Group Membership
Hi All,
So my problem is thus, I have an application that requires either of two URL's to be launched depending on what ad group a person is in.
For example, John is in one of 7 possible groups so he gets the UAT URL and Sarah is in one of a seperate 7 AD groups o she gets the PROD url.
Can I get App-V to creat one shortcut and with the help of some logic query the AD Groups and launch whichever URL?
I've been playing around with the Idea of having the shorcut point to a VBScript that checks the Memebership and in turn launches the URL.
Thanks
Automan.
Answers (5)
Option Explicit
On Error Resume Next
Dim objShell,URL_1, URL_2, groupListD, groupName, ADSPath, userPath
Dim variable
set objShell = WScript.CreateObject("WScript.Shell")
URL_1="http://www.google.com"
URL_2="http://www.gmail.com"
If isMember("Group1") Then
objShell.Run URL_1
ElseIf isMember("Group2") Then
objShell.Run URL_2
End If
Function IsMember(groupName)
If IsEmpty(groupListD) then
Set groupListD = CreateObject("Scripting.Dictionary")
groupListD.CompareMode = 1
ADSPath = EnvString("userdomain") & "/" & EnvString("username")
Set userPath = GetObject("WinNT://" & ADSPath & ",user")
For Each listGroup in userPath.Groups
groupListD.Add listGroup.Name, "-"
Next
End if
IsMember = CBool(groupListD.Exists(groupName))
End Function
Function EnvString(variable)
variable = "%" & variable & "%"
EnvString = objShell.ExpandEnvironmentStrings(variable)
End Function
Set objShell = Nothing
Set groupListD = Nothing
Set userPath = Nothing
WScript.Quit
Just push iexplore "URL" GPO's based on the context they are in.
http://www.itninja.com/link/applying-group-policy-to-a-machine-user-or-group-of-either
Thanks Guys
Comments:
-
If your problem was solved could you mark it as answered. Thanks - SMal.tmcc 12 years ago
Nice Script Jagadeish..
Comments:
-
very impressive, I voted for it - SMal.tmcc 12 years ago
The script is really good but if you want to manage the shortcut and pull it back later, or have the option to, in an enterprise the GPP application shortcut is the way to go. You can use custom item-level target filters in the GPP application shortcut to limit who can see the URL link based on AD membersship and a lot of things like OS, RAM, free space, etc...