Announcement

Collapse
No announcement yet.

Applying a VBS to a single user

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Applying a VBS to a single user

    I am kinda new to the scripting commuity. I am wondering if I can apply a .vbs to a single user when they log in?
    I see in Active Directory where you can add a .vbs to Group Policy in specific OU's.

    Any help?

  • #2
    Re: Applying a VBS to a single user

    Group policy can apply to all authenticated users or you can untick the apply for this group and just assign it to a user.
    If you use the Group Policy Management Console (link in Misc forum sticky) you can browse to the delegation tab and then advanced. Basically there is a specific setting for apply.
    cheers
    Andy

    Please read this before you post:


    Quis custodiet ipsos custodes?

    Comment


    • #3
      Re: Applying a VBS to a single user

      You can edit the script and I think it's easier then filtering it by gpo

      something like this:
      Code:
      Set ObjNetwork = WScript.CreateObject("WScript.Network")
      UserName = ObjNetwork.UserName
      
      If LCase(UserName) = "john" Then
           add your script here
      Else
           Wscript.quit (0)
      End If
      Oh, I just found this example will browsing a bit where you can find some examples of finding usernames or groups.
      http://blogs.vmware.com/thinapp/2008...p-thinreg.html

      However Rems is our scripting GURU (mine scripting knowledge is very rusty)
      Marcel
      Technical Consultant
      Netherlands
      http://www.phetios.com
      http://blog.nessus.nl

      MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
      "No matter how secure, there is always the human factor."

      "Enjoy life today, tomorrow may never come."
      "If you're going through hell, keep going. ~Winston Churchill"

      Comment


      • #4
        Re: Applying a VBS to a single user

        Indeed, another option! Possibly depends on what you want in the future. If the script will be rolled out to more then it would be best to create a group and assign apply to that group. Members can then be added to the group. Many routes, I do appreciate AD sometimes!

        Edit - didn't quite read right.
        cheers
        Andy

        Please read this before you post:


        Quis custodiet ipsos custodes?

        Comment


        • #5
          Re: Applying a VBS to a single user

          Hi,

          You can do this in two ways i can think of.

          You can do it the legacy way by going to Active Directory Users And Computers console, right-clicking on a user account, and selecting the Properties.
          In the Profiles tab there is a Logon script section where you can put in the path to the script or Just the name of the script (extension included) if it resides in the Netlogon folder.
          Just be aware that scripts with VBS extension are not supported in machines running legacy systems (Pre-2000). One way around this is to somehow embed the script into a batch file.

          Second way of doing it is via GPO.

          Configure the GPO as follows:
          User configuration - Windows settings - Scripts - Logon
          Configure the Scope so the GPO at the OU where the User account resides and then amend the Security filtering section by just adding the User account you want the Login script to apply to.

          Cheers

          ***Sorry for going over stuff already mentioned, Just noticed the posts now, must have Overlaped****
          Last edited by L4ndy; 5th November 2008, 11:02. Reason: Possible overlap
          Caesar's cipher - 3

          ZKHQ BRX HYHQWXDOOB GHFLSKHU WKLV BRX ZLOO UHDOLVH LW ZDV D ZDVWH RI WLPH!

          SFX JNRS FC U6 MNGR

          Comment


          • #6
            Re: Applying a VBS to a single user

            Originally posted by Dumber View Post
            Code:
            If LCase(UserName) = "john" Then
                 add your script here
            Else
                 Wscript.quit (0)
            End If

            For the notice, this can be done in a batch file too. Consider this:

            Code:
            :: BOF
            
            set flag=ordinaryUsers
            
            if /i %username% equ "john" (set flag=BackuOperator)
            if /i %username% equ "barry" (set flag=ExchangeAdmin)
            goto :%flag%
            
            :BackuOperator
            cscript DoStuffForJohn.vbs
            goto :end
            
            :ExchangeAdmin
            cscript DoStuffForExchangeAdmins.vbs
            goto :end
            
            :ordinaryUsers
            cscript DoOtherStuff.vbs
            goto :end
            
            :end
            
            ::EOF
            Launching cscript is not usually a performance problem, but in some cases batch files are all you got.

            -vP

            Comment


            • #7
              Re: Applying a VBS to a single user

              Correct vonPryz...
              But he already was talking about VBS so personally I'll keep it on that language.
              Marcel
              Technical Consultant
              Netherlands
              http://www.phetios.com
              http://blog.nessus.nl

              MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
              "No matter how secure, there is always the human factor."

              "Enjoy life today, tomorrow may never come."
              "If you're going through hell, keep going. ~Winston Churchill"

              Comment

              Working...
              X