none
Active Directory computer description RRS feed

  • Question

  • I am using a batch script to gather a few pieces of information about users and computers that are logging into our networks.

    The info is then written to a log file (computer name, domain name and a few of other things).

    I would like to get a computer's Active Directory (not local) computer description to add that list of items as well.

    Is this possible?  I have been searching through Google searches off and on for two days and not seeing any signs of hope.

    I know this is very easy with PowerShell and can be done with VBS, but I would like to stick with what we already have in place for now.

    I have been playing around with dsquery and it works well enough, however it's not installed on every machine in all of our domains.  I supposed that I could put dsquery in place on all machines, but I would rather avoid that.

    Thanks for any input.

    Friday, September 21, 2018 9:06 PM

Answers

  • I assume you refer to a logon script. I believe your batch file script gets the information you collect now from the local environment. The computer description in AD is not in the local environment. You are asking to query Active Directory without using VBScript, PowerShell, dsquery, or any third party tools. I don't believe it can be done.

    Edit: The following VBScript will run on any client joined to the domain:

    Set objSysInfo = CreateObject("ADSystemInfo")
    objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
    strDescr = objComputer.description
    

    The second line will raise an error if the domain is not available, or the computer is not joined to the domain. A VBScript can easily retrieve user and computer names, the NetBIOS name of the domain, etc., and write to a shared log file.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)


    Friday, September 21, 2018 9:16 PM
    Moderator

All replies

  • I assume you refer to a logon script. I believe your batch file script gets the information you collect now from the local environment. The computer description in AD is not in the local environment. You are asking to query Active Directory without using VBScript, PowerShell, dsquery, or any third party tools. I don't believe it can be done.

    Edit: The following VBScript will run on any client joined to the domain:

    Set objSysInfo = CreateObject("ADSystemInfo")
    objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
    strDescr = objComputer.description
    

    The second line will raise an error if the domain is not available, or the computer is not joined to the domain. A VBScript can easily retrieve user and computer names, the NetBIOS name of the domain, etc., and write to a shared log file.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)


    Friday, September 21, 2018 9:16 PM
    Moderator
  • I had seen that in a search and was able to embed it in the batch script and it worked, but I cannot figure out how, or if it's even possible, to share the variable without writing it to a text file and reading it back in.

    I guess I will either have to go without this or move on to PowerShell.

    Thanks.


    Monday, September 24, 2018 7:35 PM