Login script problem - Trying to assign shortcuts via group ownership 
Author Message
 Login script problem - Trying to assign shortcuts via group ownership

Hello.

I'm not your die hard coder but managed to piece together the following
script to add shortcuts to the desktop based on group membership. The
problem I am now having is trying to exclude the default groups i.e. Domain
Admins, Domain Users etc.

I have tried to add an if statement but failed dismally and  I kept getting
an invalid Next error. Any pointers gratefully recieved

'
' Set a loop to pick up the users groups
'
Dim Domain,UserObj, Group, GroupObj, UserName, nUser,wsh, sArray

'Now give them their initial values.....
Set wsh = WScript.CreateObject("Wscript.Shell")
Set nUser = WScript.CreateObject("Wscript.Network")
Domain = nUser.UserDomain
UserName = nUser.UserName

'Now get the current user name and domain from ADS....
Set UserObj = GetObject("WinNT://" & Domain & "/" & UserName)

'Go through each group, executing the .vbs file for each one......
On Error Resume Next
 For Each GroupObj in UserObj.Groups
'The next two lines strip the spaces from the Group in question
' because the script name cannot have spaces in it
 sArray= Split(GroupObj.name)
 sJoin = Join(sArray,"")

'
'This code adds shotcuts to the desktop
'

Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\" & sjoin & ".lnk")
link.Arguments = "1 2 3"
link.Description = "monitor shortcut"
link.HotKey = "CTRL+ALT+SHIFT+X"
'link.IconLocation = "app.exe,1"
link.TargetPath = "\\monitor\jim" & sjoin
 link.WindowStyle = 3
link.WorkingDirectory = "\\monitor\jim" & sjoin
link.Save

Next

Regards

Jim Florence



Mon, 15 Aug 2005 05:44:08 GMT  
 Login script problem - Trying to assign shortcuts via group ownership

Jim,

I tried your scipt.  It created two shortcuts on my desktop.
I would recommend that you change the linkTargetPath and WorkingDirectory to = \\Monitor\Jim\ & sjoin

If it helps I ran as cscript

Regards

Stephen Cannons
Consultant
MCNE, MCT, MCSE
TNE Pty Ltd ABN 90 088 862 926

Phone: 1300 659 755
mobile: +61 408 440 804

www.tne.com.au



Tue, 23 Aug 2005 21:43:30 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Login script problem - Trying to assign shortcuts via group ownership

2. Using WSH login scripts to assign temp local system admin previllege

3. Assigning login scripts

4. Creating a folder structure and then assigning permissions on that structure via script

5. Updating shortcuts via scripts

6. VBScript NT Login Script - checking for group membership

7. VBScript and NT Login Scripts - Group membership?

8. User Groups in Login Scripts

9. Domain Login-Script / regarding user′s groups

10. check group in login script

11. User Groups in Login Scripts

12. Logon Script via GPO tries to load on XP when there is no network connection

 

 
Powered by phpBB® Forum Software