Guys I have a following script:

if ingroup("Group1")
WshShortCut("%userprofile%\desktop\icon1.lnk","D:\Group1\app1.mde")
WshShortCut("%userprofile%\desktop\icon2.lnk","D:\Group1\app2.mde")
endif

if ingroup("Group2")
WshShortCut("%userprofile%\desktop\icon1.lnk","D:\Group2\app1.mde")
WshShortCut("%userprofile%\desktop\icon2.lnk","D:\Group2\app2.mde")
endif

if ingroup("Group3")
WshShortCut("%userprofile%\desktop\icon1.lnk","D:\Group3\app1.mde")
WshShortCut("%userprofile%\desktop\icon2.lnk","D:\Group3\app2.mde")
endif

function WshShortCut($path,$targetpath,optional $arguments,optional $startdir,optional $iconpath,optional $style)
dim $shell,$shortcut
$shell=createobject("wscript.shell")
if $shell
$shortcut=$shell.createshortcut($path)
if $shortcut
$shortcut.targetpath=$targetpath
if $arguments
$shortcut.arguments=$arguments
endif
if $startdir
$shortcut.workingdirectory=$startdir
endif
if $iconpath
$shortcut.iconlocation=$iconpath
endif
if $style
$shortcut.windowstyle=$style
endif
$shortcut.save
$shortcut=0
endif
$shell=0
endif
exit @error
endfunction

What I am trying to accomplish is for this script to check user's group membership at logonn and "publish" all appropriate icons for him. So if a user belongs to Group1 only, he gets only those icons. But if a user belongs to Group1 AND Group3, he gets icons for Group1 AND Group3.
At the moment it appears to only give him one set of icons.
Any ideas?

P.S. I have posted this couple of days ago, but now I cant find the thread and even had to re-register for the forums. Not sure what happened.

Thank you in advance for all your help!


Edited by vitaly91 (2006-12-01 10:34 PM)