Active Directory quesiton/issue
I am using Windows Server 2003 R2 x64 Standard and I remember some of my computers reporting the description back to the domain controller and showing the location I placed into it so I know where they are throught the facility. Now for some reason there are no descriptions in active directory under the description tab for any of the computers on the domain. The other feilds do report like the name of the computer and what operating system it is just not the description. Any ideas anyone?
April 8th, 2010 6:05pm

Hello if you right click and properties for each computer under description fiedl do you see anything? Also , under ADUC, go to view, add/removecolumn, make sure description is listedIsaac Oben MCITP:EA, MCSE
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2010 10:25pm

The Description and Location Field are not automatically populated like the others you are referrring to such as Operating System. If you want them to auto-populate, you would have to devise some type of script that runs on the workstation (via startup script possibly) or some other manner, and updates the object in AD (of course you would have to delegate those permissions corretly on the computer objects). Otherwise, manual input is the only other alternative.Visit my blog: anITKB.com, an IT Knowledge Base.
April 8th, 2010 11:11pm

The confusion arises because there are two descriptions for computers. In Active Directory the computer object has a Description attribute, that shows up in ADUC. On the computer itself there is a different description (I call the local description) that shows up on the Computer Name tab in Control Panel, System. I have been unable to find a WMI class that retrieves the value of the local description from the computer. The only way I see to retrieve this, and possibly use it to populate the Description attribute of the AD object, is to retrieve it from the registry. The key is: HKLM\System\CurrentControlSet\Services\Lanmanserver\Parameters In this key is the entry "srvcomment", which will be the local description. You could code a script to enumerate all computer objects in AD, connect to each remotely with WMI (the ones that are available), retrieve the local description from the registry, then update the description attribute of the corresponding AD object. Would you be interested in this? Richard MuellerMVP ADSI
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2010 4:18am

Thanks guys. I think I must have updated the description within AD and that is why they showed up for me when I am inside ADUC. When I deployed all the new machines I updated the other description feild on the local computer in system properties. I am not the best at writing scripts. Can map a drive and printers but nothing fancy. I might resort to terminal serving into each and grabbing the key above to update my ADUC view. But it would be great for a script that pulls it when the machine starts or logs in so in the event I do change the location in the feild it updates to ADUC so 8 months down the road I dont have to remember where the heck I put it if I forgot to update the move. lol Thanks again everyone. You guys rock.
April 14th, 2010 12:46am

Following is a VBScript program that uses ADO to retrieve the NetBIOS names of all computers in the domain. For each computer the program pings the machine to see if it is available. If it is available, the program connects with WMI and retrieves the registry setting for the local computer description. The program outputs computer name and description (or a note), comma delimited. The program follows:Option ExplicitDim strComputer, objShellDim objRootDSE, strDomain, adoConnection, adoCommand, strQueryDim adoRecordset, strAttributes, objRemoteDim strKeyPath, strEntryName, strValueConst HKEY_LOCAL_MACHINE = &H80000002Set objShell = CreateObject("Wscript.Shell")' Determine DNS domain name from RootDSE object.Set objRootDSE = GetObject("LDAP://RootDSE")strDomain = objRootDSE.Get("defaultNamingContext")' Use ADO to search Active Directory for all computers.Set adoCommand = CreateObject("ADODB.Command")Set adoConnection = CreateObject("ADODB.Connection")adoConnection.Provider = "ADsDSOObject"adoConnection.Open = "Active Directory Provider"adoCommand.ActiveConnection = adoConnection' Retrieve NetBIOS name of computers.strAttributes = "sAMAccountName"strQuery = "<LDAP://" & strDomain _ & ">;(ObjectCategory=computer);" & strAttributes & ";subtree"adoCommand.CommandText = strQueryadoCommand.Properties("Page Size") = 100adoCommand.Properties("Timeout") = 30adoCommand.Properties("Cache Results") = FalseSet adoRecordset = adoCommand.Execute' Enumerate computer objects.Do Until adoRecordset.EOF strComputer = adoRecordset.Fields("sAMAccountName").Value ' Remove trailing "$". strComputer = Left(strComputer, Len(strComputer) - 1) ' Ping computer to see if online. If (IsConnectible(strComputer, 1, 750) = True) Then ' Connect to computer with WMI. On Error Resume Next Set objRemote = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _ & strComputer & "\root\default:StdRegProv") If (Err.Number <> 0) Then On Error GoTo 0 Wscript.Echo strComputer & ",<failed to connect>" Else On Error GoTo 0 strKeyPath = "System\CurrentControlSet\Services\Lanmanserver\Parameters" strEntryName = "srvcomment" objRemote.GetStringValue HKEY_LOCAL_MACHINE, _ strKeyPath, strEntryName, strValue If (IsNull(strValue) = True) Then Wscript.Echo strComputer & ",<no description>" Else Wscript.Echo strComputer & ",""" & strValue & """" End If End If Else Wscript.Echo strComputer & ",<not available>" End If adoRecordset.MoveNextLoopadoRecordset.Close' Clean up.adoConnection.CloseFunction IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO) ' Returns True if strHost can be pinged. ' strHost is the NetBIOS name or IP address of host computer. ' intPings is number of echo requests to send. ' intTO is timeout in milliseconds to wait for each reply. ' Based on a program by Alex Angelopoulos and Torgeir Bakken, ' as modified by Tom Lavedas. ' Variable objShell has global scope and must be declared ' and set in the main program. ' Requires Windows NT or above. Dim lngResult If (intPings = "") Then intPings = 2 End If If (intTO = "") Then intTO = 750 End If lngResult = objShell.Run("%comspec% /c ping -n " & intPings _ & " -w " & intTO & " " & strHost _ & " | find ""TTL="" > nul 2>&1", 0, True) Select Case lngResult Case 0 IsConnectible = True Case Else IsConnectible = False End SelectEnd Function You should run this at a command prompt using the cscript host program so you can redirect the output to a text file. For example, if the VBScript program is saved in the file CmptrDesc.vbs, then at a command prompt navigate to the folder where this file is saved and enter:cscript //nologo CmptrDesc.vbs > report.csvThe "//nologo" optional parameter suppresses logo info. If the file CmptrDesc.vbs is not in the current folder, include the full path. The file report.csv is created in the current folder with the output from the program. This file can be read into a spreadsheet program.Richard MuellerMVP ADSI
Free Windows Admin Tool Kit Click here and download it now
April 15th, 2010 5:34am

I apologize. The "Insert Code Block" function is removing all carriage returns, making the code I posted impossible to read (Microsoft is working on the problem). Here is my code again, but pasted in the message, so it may be double spaced (or word wrapped or improperly formatted):====================Option ExplicitDim strComputer, objShellDim objRootDSE, strDomain, adoConnection, adoCommand, strQueryDim adoRecordset, strAttributes, objRemoteDim strKeyPath, strEntryName, strValueConst HKEY_LOCAL_MACHINE = &H80000002Set objShell = CreateObject("Wscript.Shell")' Determine DNS domain name from RootDSE object.Set objRootDSE = GetObject("LDAP://RootDSE")strDomain = objRootDSE.Get("defaultNamingContext")' Use ADO to search Active Directory for all computers.Set adoCommand = CreateObject("ADODB.Command")Set adoConnection = CreateObject("ADODB.Connection")adoConnection.Provider = "ADsDSOObject"adoConnection.Open = "Active Directory Provider"adoCommand.ActiveConnection = adoConnection' Retrieve NetBIOS name of computers.strAttributes = "sAMAccountName"strQuery = "<LDAP://" & strDomain _ & ">;(ObjectCategory=computer);" & strAttributes & ";subtree"adoCommand.CommandText = strQueryadoCommand.Properties("Page Size") = 100adoCommand.Properties("Timeout") = 30adoCommand.Properties("Cache Results") = FalseSet adoRecordset = adoCommand.Execute' Enumerate computer objects.Do Until adoRecordset.EOF strComputer = adoRecordset.Fields("sAMAccountName").Value ' Remove trailing "$". strComputer = Left(strComputer, Len(strComputer) - 1) ' Ping computer to see if online. If (IsConnectible(strComputer, 1, 750) = True) Then ' Connect to computer with WMI. On Error Resume Next Set objRemote = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _ & strComputer & "\root\default:StdRegProv") If (Err.Number <> 0) Then On Error GoTo 0 Wscript.Echo strComputer & ",<failed to connect>" Else On Error GoTo 0 strKeyPath = "System\CurrentControlSet\Services\Lanmanserver\Parameters" strEntryName = "srvcomment" objRemote.GetStringValue HKEY_LOCAL_MACHINE, _ strKeyPath, strEntryName, strValue If (IsNull(strValue) = True) Then Wscript.Echo strComputer & ",<no description>" Else Wscript.Echo strComputer & ",""" & strValue & """" End If End If Else Wscript.Echo strComputer & ",<not available>" End If adoRecordset.MoveNextLoopadoRecordset.Close' Clean up.adoConnection.CloseFunction IsConnectible(ByVal strHost, ByVal intPings, ByVal intTO) ' Returns True if strHost can be pinged. ' strHost is the NetBIOS name or IP address of host computer. ' intPings is number of echo requests to send. ' intTO is timeout in milliseconds to wait for each reply. ' Based on a program by Alex Angelopoulos and Torgeir Bakken, ' as modified by Tom Lavedas. ' Variable objShell has global scope and must be declared ' and set in the main program. ' Requires Windows NT or above. Dim lngResult If (intPings = "") Then intPings = 2 End If If (intTO = "") Then intTO = 750 End If lngResult = objShell.Run("%comspec% /c ping -n " & intPings _ & " -w " & intTO & " " & strHost _ & " | find ""TTL="" > nul 2>&1", 0, True) Select Case lngResult Case 0 IsConnectible = True Case Else IsConnectible = False End SelectEnd Function===========Richard MuellerMVP ADSI
April 16th, 2010 7:13pm

Hi Customer, Have you gotten a chance to test Richard's script? Please let us know the result once you did the test, thanks. Regards, Wilson JiaThis posting is provided "AS IS" with no warranties, and confers no rights. Please click "Mark as Answer" when you get the correct reply to your question.
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2010 12:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics