Use Computer Name Argument to set AD Description RRS feed

  • Question

  • Hello,

    I obtained this piece of VB code on the web to help me set the AD computer description while deploying computers using MDT.  I know it takes a "description" argument from the command line but I was wondering if it could be reworked to take a computer name argument to collect the computers AD container then use the description argument to set it.

    I know nothing about VB but was hoping someone could rework it... Any will be appreciated.

    dim Computerdn, strComputerName
    dim Args
    Set WshShell = WScript.CreateObject("WScript.Shell")
    '----Get Computer DN------
    Set objADSysInfo = CreateObject("ADSystemInfo")
    ComputerDN = objADSysInfo.ComputerName
    strcomputerdn = "LDAP://" & computerDN
    Set objADSysInfo = Nothing
    '-----Read commandline---
    Set args = WScript.Arguments
    strdesc = args(0)
    Addcompdesc strdesc
    Function addcompdesc(strPCdescription)
     Set objComputer = GetObject (strComputerDN)
     objComputer.Put "Description", strPCdescription
    end function

    Monday, July 17, 2017 9:52 PM

All replies