Answered How to change group members logon script

  • Saturday, October 06, 2012 3:59 PM
     
     

    HI

    does someone know how to do this:

    i need to get the members of a group to be having a specific logon script but i dont want to pass through gpo.

    I would like to get it done via DS command.

    any idea?

All Replies

  • Saturday, October 06, 2012 11:26 PM
     
     

    Hi

    logon script can be invoked via GPO or the users properties

    I don't think that you can configure it with DS commands.

    T.

  • Sunday, October 07, 2012 12:57 AM
     
      Has Code

    By a generic logon script in vbscript it could be done.

    Like;

    Set objNetwork = CreateObject("Wscript.Network")
    
    Set objSysInfo = CreateObject("ADSystemInfo")
    strUserDN = objSysInfo.UserName
    strComputerDN = objSysInfo.ComputerName
    
    Set objGroup1 = GetObject("LDAP://CN=GROUPA,OU=Users,DC=CONTSO,DC=local")
    If (objGroup1.IsMember("LDAP://" & strUserDN) = True) Then
    
    
    ; do start any command here if the user is in group a
    
    else
    
    ...
    
    endif


    MCP | MCTS 70-236: Exchange Server 2007, Configuring

    Want to follow me ?  |  Blog: http://www.jabea.net | http://blogs.technet.com/b/wikininjas/

  • Sunday, October 07, 2012 12:26 PM
     
     

    HI

    does someone know how to do this:

    i need to get the members of a group to be having a specific logon script but i dont want to pass through gpo.

    I would like to get it done via DS command.

    any idea?

    Why you don't want to pass by GPOs? This could be easily done via group policies.

    You can proceed like that:

      • Create a new GPO
      • Add your script as part of the GPO
      • Create a group and add the wanted users or computers as members
      • Link the GPO at the domain level and use Security Filtering to specify that it will be applied only on the group you created


    This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.   

    Microsoft Student Partner 2010 / 2011
    Microsoft Certified Professional
    Microsoft Certified Systems Administrator: Security
    Microsoft Certified Systems Engineer: Security
    Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
    Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
    Microsoft Certified Technology Specialist: Windows Server 2008 Applications Infrastructure, Configuration
    Microsoft Certified Technology Specialist: Windows 7, Configuring
    Microsoft Certified Technology Specialist: Designing and Providing Volume Licensing Solutions to Large Organizations
    Microsoft Certified IT Professional: Enterprise Administrator
    Microsoft Certified IT Professional: Server Administrator
    Microsoft Certified Trainer

  • Sunday, October 07, 2012 7:19 PM
     
     

    You can do it with DSGET but if you have nested groups you'll run into issues. It's much better using a scripting language. However here's how it can be done using DSGET:

    dsget group "cn=Domain Admins,cn=Users,dc=contoso,dc=local" -members -expand | dsget user -display -loscr

    The -loscr parameter will read the scriptPath attribute. After you'll get the list you can sort it out (Excel probably).

    Regards,
    Andrei Ungureanu
    www.winadmin.ro


    Andrei Ungureanu www.winadmin.ro


  • Monday, October 08, 2012 9:36 AM
    Moderator
     
     Answered

    Hi,

    If we want to assign a logon script to a user we could try the following methods:

    To assign a logon script to a user in the Active Directory

    1. Open Active Directory Users and Computers.
    2. In the console tree, click Users.
    3. Double-click the user to which you want to assign the logon script.
    4. Click the Profile tab.
    5. In the Logon script field, type the path and name of the logon script you want to assign to that user, and then click OK.

    For details, please refer to the following article.

    Logon Scripts

    http://technet.microsoft.com/en-us/library/cc757263(v=ws.10).aspx

    If we choose to assign user logon script via command and PowerShell, I suggest we’d better ask in the script forum.

    The Official Scripting Guys Forum!

    http://social.technet.microsoft.com/Forums/en-US/ITCG/threads

    Regards,

    Andy