GPO - Active Directory Update Computer Description with User Name using VB login Script

AID: 8069
  • Status: Published

1740 points

  • By
  • TypeTutorial
  • Posted on2011-10-05 at 02:28:05
Ok so now I will show you how to add a user name to the description at login.

First connect to your DC (Domain Controller / Active Directory Server)

SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME
1. Open Active Directory Users and Computers (ADUC)
2. Right Click your "dommain.com" and click "Properties"
3. Select the "Security Tab" and click "Advanced" button
4. Click "Add" and then type "Authenticated Users" and click "OK"
5. No on the "Apply to:" drop down box locate and select "Descendant Computer objects"
6. Now in the Permissions window select the Allow check box for "Write all properties"
7. Click "OK", "OK" and "OK" again.

CREATE SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME
1. Click start > run and type: notepad
2. Click "OK"
3. Now copy and paste the following code:
 Set objSysInfo = CreateObject("ADSystemInfo")

Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)

strMessage = objUser.CN & " logged in at " & objComputer.CN & " " & Now & "."

'objUser.Description = strMessage
'objUser.SetInfo

objComputer.Description = strMessage
objComputer.SetInfo
 
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:

Select allOpen in new window



4. Now save this file to your desktop as AddUserDescriptionToAD.vbs
5. And that concludes the script

ADD SCRIPT TO GROUP POLICY TO UPDATE COMPUTER DESCRIPTION TO USERNAME
1. Open "Group Policy Manager" - Start > Administrative Tools > Group Policy Management
2. Expand "Forest: yourdomain.com"
3. Expand "Domains"
4. Expand "yourdomain.com"
5. Right click "Group Policy Objects" and select "New"
6. In the "Name" field type: User Configuration: Add Username to Computer Description
7. And click "OK"
8. Now under the "Group Policy Objects" locate the new GPO that was created "User Configuration: Add Username to Computer Description"
9. Right click the policy and click "Edit"
10. In the "Group Policy Management Editor" expand "User Configuration"
11. Expand "Policies"
12. Expand "Windows Settings"
13. And select "Scripts(Logon/Logoff)"
14. In the right pane double click "Logon"
15. Now click on "Show Files" (This will open the directory where you will need to copy the script AddUserDescriptionToAD.vbs)
16. So go to your Desktop and copy the "AddUserDescriptionToAD.vbs" script and paste it in the location that opened after click the "Show Files" button
17. Now go back to the "Logon Properties" window and click the "Add..." button
18. Now click the "Browse" button and double click the "AddUserDescriptionToAD.vbs" file.
19. Click "OK" and click "OK" again.
20. Close the "Group Policy Management Editor"

Next we will need to apply this policy to everyone.

APPLY NEW GPO (Group Policy Object) to All Users
1. On your "Group Policy Management" window
2. Ensure that you have expanded the "Forest:yourdomain.com > Domains > yourdomain.com"
3. Now right click on "yourdomain.com" and click "Link an Existing GPO..."
4. From the "Group Policy objects" list select the new Policy "User Configuration: Add Username to Computer Description" and click "OK"

Job done, now you can get your domain users to restart their computers and you will note that the Computer Description in AD has now change to the following:

NAME LASTNAME logged in at COMPUTERNAME 2010/08/31 09:40:51.

Please let me know if this article was helpful. This Article also appears in my blog : http://helewix.com/blog/index.php/Microsoft-Solutions/?blog=1&paged=5

Kind Regards,
Hendrik Wiese
Asked On
2011-10-05 at 02:28:05ID8069
Tags

GPO

,

Update Computer Description with Username

,

VB Script

,

Active Directory

Topic

Active Directory

Views
1024

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Active Directory Experts

  1. mkline71

    412,697

    Wizard

    3,000 points yesterday

    Profile
    Rank: Genius
  2. dariusg

    163,412

    Guru

    0 points yesterday

    Profile
    Rank: Genius
  3. dvt_localboy

    136,278

    Master

    0 points yesterday

    Profile
    Rank: Sage
  4. demazter

    116,263

    Master

    0 points yesterday

    Profile
    Rank: Genius
  5. iSiek

    113,702

    Master

    0 points yesterday

    Profile
    Rank: Genius
  6. motnahp00

    92,762

    Master

    0 points yesterday

    Profile
    Rank: Sage
  7. acbrown2010

    81,763

    Master

    10 points yesterday

    Profile
    Rank: Genius
  8. Jmoody10

    71,214

    Master

    1,210 points yesterday

    Profile
    Rank: Wizard
  9. yo_bee

    68,718

    Master

    0 points yesterday

    Profile
    Rank: Guru
  10. kevinhsieh

    60,310

    Master

    0 points yesterday

    Profile
    Rank: Genius
  11. KenMcF

    56,098

    Master

    0 points yesterday

    Profile
    Rank: Genius
  12. snusgubben

    55,438

    Master

    0 points yesterday

    Profile
    Rank: Sage
  13. pwindell

    54,060

    Master

    2,800 points yesterday

    Profile
    Rank: Genius
  14. KCTS

    52,196

    Master

    0 points yesterday

    Profile
    Rank: Genius
  15. leew

    51,399

    Master

    0 points yesterday

    Profile
    Rank: Savant
  16. PrashantGirennavar

    46,884

    3,000 points yesterday

    Profile
  17. Neilsr

    46,472

    0 points yesterday

    Profile
    Rank: Genius
  18. xxdcmast

    42,972

    1,100 points yesterday

    Profile
    Rank: Genius
  19. Anuroopsundd

    38,834

    0 points yesterday

    Profile
    Rank: Sage
  20. dstewartjr

    37,595

    0 points yesterday

    Profile
    Rank: Genius
  21. RobSampson

    36,382

    0 points yesterday

    Profile
    Rank: Genius
  22. ve3ofa

    34,856

    1,800 points yesterday

    Profile
    Rank: Genius
  23. amitkulshrestha

    34,647

    0 points yesterday

    Profile
    Rank: Genius
  24. alanhardisty

    32,393

    0 points yesterday

    Profile
    Rank: Genius
  25. McKnife

    32,203

    2,000 points yesterday

    Profile
    Rank: Genius

Hall Of Fame