help with vbs script

Dell / GX280
May 25, 2010 at 12:00:06
Specs: WinXP, 2GB
hi, I am not a programmer but I need help with creating VB script upon user logon, so that if user belongs to specific OU and /or group, there is a shortcut icon created on desktop. if none belong to group and/or OU, no change at all.


See More: help with vbs script

Report •

May 25, 2010 at 12:46:16
hopefully this will get you started

Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)

Set objGroup = GetObject("LDAP://cn=TESTGROUP,ou=Users,dc=Mydomain,dc=com")

If (objGroup.IsMember(objUser.AdsPath) = True) Then
    strWorkDir ="C:\windows"
    strAppPath = "%SystemRoot%\notepad.exe"
    strIconPath = "%SystemRoot%\system32\SHELL32.dll,5"

    Set objShell = CreateObject("WScript.Shell")
    objDesktop = objShell.SpecialFolders("Desktop")
    Set objLink = objShell.CreateShortcut(objDesktop & "\WordProcess.lnk")

    objLink.Description = "WordProcess"
    objLink.HotKey = "CTRL+SHIFT+X"
    objLink.IconLocation = strIconPath
    objLink.TargetPath = strAppPath
    objLink.WindowStyle = 3
    objLink.WorkingDirectory = strWorkDir

End If 

I have just put together stuff I found online in 2 minutes but this should give you something to work with, use google it really can help you.

Good luck!

Report •
Related Solutions

Ask Question