Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to access groups and icons

Status
Not open for further replies.

LotsofQuestions

Technical User
Nov 24, 2003
8
GB
Good morning,

I am looking at writing a logon script to do the following:

1. Check to see which group the users is a member of.
2. Once membership is checked the correct icons for each user is installed as per group membership on the Desktop and Programs area.
3. A check of the workstation to see which software is installed and only those icons are put into the desktop.

I have seen a few scripts and tried putting them together with some succsess, but I am still finding it hard to do the ldap for the group membership.

We will have the following groups:

Graphic users
Normal Users
Advanced users
Domain Admins


Any help would be appreciated.

This is what I have done so far:

Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
str2Find = WshShell.ExpandEnvironmentStrings("%programfiles%\Microsoft Office\OFFICE11\MSACCESS.EXE")
intReturn = 1
str2Run = WshShell.ExpandEnvironmentStrings("%programfiles%\Microsoft Office\OFFICE11\MSACCESS.EXE")
If FSO.FileExists(str2Find) Then


If FSO.FileExists(str2Run) Then
SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
strDsk = WshShell.SpecialFolders("Desktop")
strshortcut = strDsk & "\MSACCESS.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
oUrlLink.Save
End If
SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
strDsk = WshShell.SpecialFolders("Programs")
strshortcut = strDsk & "\MSACCESS.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
oUrlLink.Save
End If
End If
Else
intReturn = 0
End If
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
str2Find = WshShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\OFFICE11\MSPUB.EXE")
intReturn = 1
str2Run = WshShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\OFFICE11\MSPUB.EXE")
If FSO.FileExists(str2Find) Then


If FSO.FileExists(str2Run) Then
strDsk = WshShell.SpecialFolders("Programs")
strshortcut = strDsk & "\Publisher.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\MSPUB.EXE"
oUrlLink.Save
End If
strDsk = WshShell.SpecialFolders("Desktop")
strshortcut = strDsk & "\Publisher.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\MSPUB.EXE"
oUrlLink.Save
End If
End If
Else
intReturn = 0
End If

Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
str2Find = WshShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\OFFICE11\Outlook.EXE")
intReturn = 1
str2Run = WshShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\OFFICE11\Outlook.EXE")
If FSO.FileExists(str2Find) Then


If FSO.FileExists(str2Run) Then
strDsk = WshShell.SpecialFolders("Programs")
strshortcut = strDsk & "\Outlook.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\Outlook.EXE"
oUrlLink.Save
End If
strDsk = WshShell.SpecialFolders("Desktop")
strshortcut = strDsk & "\Outlook.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\Outlook.EXE"
oUrlLink.Save
End If
End If
Else
intReturn = 0
End If


Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
str2Find = WshShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\OFFICE11\Out.EXE")
intReturn = 1
str2Run = WshShell.ExpandEnvironmentStrings("C:\Program Files\Microsoft Office\OFFICE11\Out.EXE")
If FSO.FileExists(str2Find) Then


If FSO.FileExists(str2Run) Then
strDsk = WshShell.SpecialFolders("Programs")
strshortcut = strDsk & "\Outlook1.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\Outlook.EXE"
oUrlLink.Save
End If
strDsk = WshShell.SpecialFolders("Desktop")
strshortcut = strDsk & "\Outlook1.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\Outlook.EXE"
oUrlLink.Save
End If
End If
Else
intReturn = 0
End If
Set WshShell = Nothing
Set FSO = Nothing
Wscript.Quit intReturn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top