Script to automatically change description field

Discussion in 'Scripting' started by Microsoft News, Oct 26, 2004.

  1. Do you all know of any scripts to automatically change the description field
    for computers???
    Microsoft News, Oct 26, 2004
    1. Advertisements

  2. Didn't you post something along this line earlier?

    When you say you want a script to do something "automatically", it is not
    clear to me exactly what you mean. I could write a script that would change
    the description field of any number of computers to whatever I wanted them
    to be set to, but this would only happen when I run the script.
    Automatically suggests to me that you want this to happen spontaneously as a
    response to some change or other that might happen in the environment.

    If you would explain further what it is you want, I think you will get more
    useful responses.

    Al Dunbar [MS-MVP], Oct 27, 2004
    1. Advertisements

  3. Hi

    Here is an example updating the computer description in AD with
    current user's name (assuming sufficient rights for the user
    against the computer object):


    Set oADSystemInfo = CreateObject("ADSystemInfo")
    ' get user object
    Set oUser = GetObject("LDAP://" & oADSystemInfo.UserName)
    ' get full name of the current user
    sDescription = oUser.DisplayName

    ' get computer object
    Set oComputer = GetObject("LDAP://" & oADSystemInfo.ComputerName)

    ' update description field for computer object
    oComputer.PutEx ADS_PROPERTY_UPDATE, "description", Array(sDescription)

    If you want to work through a list of computers, take a look at
    this post:
    Torgeir Bakken \(MVP\), Oct 27, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.