LotsofQuestions
Technical User
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
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