Symantec Management Platform (Notification Server)

 View Only
Expand all | Collapse all

Collection based on AD Description Field?

KSchroeder

KSchroederOct 27, 2009 10:32 AM

  • 1.  Collection based on AD Description Field?

    Posted Oct 26, 2009 01:22 PM
    I would like to build a computer collection based on the AD description field for a computer. For example, the description contains the word Conference. We do a full AD import every month and update weekly. I'm not sure where this information is stored in the Altiris DB. Anyone have any ideas?


  • 2.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 01:31 PM
    Hi durkinr,
    Is this the same as the "Comment" or "Computer description" field you see when you open the System control panel and click the "Computer Name" tab?  If it is there is a custom inventory already created for that.  If it is an AD computer object property, we can work with that too without too much trouble.

    Let me know; I can point you to the existing Custom Inventory or work with you to generate a custom inventory for the machine's computer object properties in AD.


  • 3.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 01:48 PM
    It is the AD computer object description.

    I'd like to see the custom inventory you are talking about as well, that might be useful for other purposes.

    Thanks!


  • 4.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 02:47 PM
    This thread has the custom inventory with the Computer description field.  I'll have to do a little digging to get the computer description value, but I'll see what I can find.


  • 5.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 03:58 PM

    OK, save the following as GetADDescription.vbs, save it to your \\nsserver\nscap\bin\win32\x86\Inventory Solution\ folder, and add it to your AeXInvSolnAdm1.ini file before the final line:
    wscript.exe GetADDescription.vbs
     

    Option Explicit
    On Error Resume Next  ' fail silently
     
    Dim oShell, oAdSysInfo,o
    Dim sDN, sDescription
    
    Set oShell = CreateObject("WScript.Shell")
    Set oAdSysInfo = CreateObject("ADSystemInfo")
    sDN = oAdSysInfo.ComputerName
    Set o = GetObject("LDAP://" & sDN)
    
    sDescription = o.Description
    oShell.RegWrite "HKLM\Software\MyCompany\Inventory\AD-Comp-Description", sDescription, "REG_SZ"
    
    Set oShell = Nothing
    Set oAdSysInfo = Nothing
    Set o = Nothing
    
    WScript.Quit(0)


    Once that is done, you'll need to create a custom inventory template XML file, borrowing from the previous thread:

    <InventoryClasses>
      <InventoryClass name='AeX AD Computer Description' manufacturer='Altiris' description='This data class contains the description of the computer as seen in Active Directory' version='1.0' platform='Win32' mifClass='Altiris|AD_Comp_Desc|1.0'>
    <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
       <s:Schema id="RowsetSchema">
          <s:ElementType name="row" content="eltOnly" rs:updatable="true">
    <s:AttributeType name="c0" rs:name="Description" rs:number="1" rs:nullable="true" mifAttrId="1">
        <s:datatype dt:type="string" dt:maxLength="255"/>
    </s:AttributeType>
          </s:ElementType>
       </s:Schema>
    <rs:data>
    <%set path="HKEY_LOCAL_MACHINE\Software\MyCompany\Inventory"%>
    <z:row c0="<%writexml "reg:%path%\AD-Comp-Description"%>"/>
    </rs:data>
     </xml>
     </InventoryClass> </InventoryClasses>

    Save that as AeXAdCompInfo.xml in your Inventory Solution directory, then add the following line beneath the wscript.exe line above:
    AeXCustInv.exe /in .\AeXAdCompInfo.xml /out AeXAdCompInfo.nsi
     



  • 6.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 05:35 PM
    durkinr:
    I created your request as a Connect Download; hopefully you can access it (though it hasn't been "published" yet).  You can check it out here.


  • 7.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 05:42 PM

    Can't get the download yet, but I'll keep trying. Thanks for all the help,

      -Rob
     



  • 8.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 05:53 PM
    I'll update this thread when the download is approved.  usually that happens within 24 hours.  Otherwise, just copy/paste the info in the "Code" blocks above and save them as suggested and it will work fine.

    I did make some minor changes to the .XML file and script in the download (to avoid writing a value if nothing is set for a particular object), but it shouldn't hurt anything except you'll have items in the report which don't have any value defined.


  • 9.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 05:55 PM
    I've just published the download http://www.symantec.com/connect/downloads/custom-inventory-gather-ad-description-field

    How's that for snappy service?


  • 10.  RE: Collection based on AD Description Field?

    Posted Oct 26, 2009 06:58 PM
    Wow, that is the fast service! Thanks again for the help.

    Now if you could just speedup the release of Asset Management for NS7...


  • 11.  RE: Collection based on AD Description Field?

    Posted Oct 27, 2009 10:32 AM
    Thanks Cheryl, you rule! :)


  • 12.  RE: Collection based on AD Description Field?

    Posted Oct 27, 2009 04:13 PM
    The hardware inventory job runs with exit code 0, and the registry key is created with the AD-Comp-Description value, but the upload of the inventory file fails.

    Here is the error on the client:

    Oct 27 12:59:29 CompressFile AeXNetComms.dll Error while compressing file: C:\Program Files\Altiris\Altiris Agent\Queue\pdcnt31\NSE18E0.tmp: Cannot open input file: The process cannot access the file because it is being used by another process. (-2147024864) AeXNSAgent.exe

    It seems the compression and upload can't run because it is in-use by another process.

    Here is my AeXInvSolnAdm1.ini file contents:

    aexmachinv.exe /ini MachInvAdm.ini
    aexcustinv.exe /in .\AeXCustInvStd.cit /out AeXCustInvStd.nsi
    aexsnplus.exe /output xml
    wscript.exe //B GetADDescription.vbs
    aexcustinv.exe /in .\AeXADCompDesc.xml
    aexnsinvcollector.exe /hidden /nsctransport /v default /useguid

    Any ideas on how to make the compress and upload work?


  • 13.  RE: Collection based on AD Description Field?

    Posted Oct 27, 2009 05:07 PM
    Well, you could try putting AeXSNPlus.exe after the Aexcustinv.exe in case it is not yet done with creating that file somehow...but that would be rather strange.  Try running FileMon with a filter set for AeX AD Comp Desc.ini to see if you can pick up what app is locking the file.  Or shut down your AV as a test when the inventory job runs.  We've seen similar issues (but on the NS in the \NSCap\EvtQFast\Process folder) when our AV was too slow in closing the file and the Altiris process was trying to load it into the database.


  • 14.  RE: Collection based on AD Description Field?

    Posted Oct 27, 2009 05:52 PM
    OK, overcame the file in use error, now the event log on the client is clean, as well as on the server, however it is still not creating the table. Exit code is 0 on the client and there is nothing in the log on the server. \\server\NSCap\EvtQFast\Process has been removed from scanning by AV already, but that is a good tip.


  • 15.  RE: Collection based on AD Description Field?

    Posted Oct 28, 2009 10:47 AM
    Hmm, OK.  Take a look at the .NSI file in the \altiris\express\inventory folder; can you paste it in here?  Did it generate a .bak file? Maybe something is off in the formatting somehow.  Try re-running it again, then after the file clears the EvtQFast, check the "Bad" folder (or just watch the NS Log using LogViewer.exe) to see if it is rejecting the value for some reason.


  • 16.  RE: Collection based on AD Description Field?
    Best Answer

    Posted Oct 28, 2009 11:05 AM
    Doh..I think I know why it is failing.  I have updated the download.  I forgot (somehow) one of the XML tags (specifically  <InventoryClasses>) and that broke it, although it processed fine by the AeXCustInv.exe...


  • 17.  RE: Collection based on AD Description Field?

    Posted Oct 28, 2009 02:54 PM
    The updated file did the trick, and I did catch that as well, but it took me a while to figure out what was wrong, becuase I am getting weird results from one of my main test machine. That is a whole different subject but the summary is it does not process the .nsi files properly every time it runs an inventory. It often leaves the .nsi and .bak files in the express\inventory folder, for no reason I have been able to detect yet.

    So in order to test this I created a new inventory job (instead of using the hardware inventory), and ran it against a group of 5 or so machines and they all worked perfectly the first time. That would have saved me about 3 hours had I used more than one test machine!

    This is the custom inventory  file, AeXCompCustInv.ini:

    wscript.exe //B GetADDescription.vbs
    aexcustinv.exe /in .\AeXADCompDesc.xml
    aexnsinvcollector.exe /hidden /nsctransport /v default /useguid

    And I created a new inventory job with the command line:
    AeXInvSoln.exe /hidden /s AeXCompCustInv.ini

    In case anyone else wants to give it a shot.

    BTW, you can also test this from a batch file to verify it works before running it in Altiris. The contents of the batch file would look exactly like the contents of the ini file above. Just make sure you have a copy of AeXCustInv.exe and AeXNSInvCollector.exe in your test folder, along with the script and XML file.

    Thanks for sticking with it, Kyle-

      -Rob




  • 18.  RE: Collection based on AD Description Field?

    Posted Nov 25, 2009 11:00 AM
    Hi Kyle
         I try to customize inventory 7.0 to capture computer description. Do you have any idea.

    Thanks
    Manas


  • 19.  RE: Collection based on AD Description Field?

    Posted Nov 25, 2009 02:36 PM
    Manas,
    You should probably start a new thread about this issue, and link back to this one for reference.

    Custom Inventory in IS7 is a bit different from NS6 (though there are ways to run your NS6 custom inventory in NS7).  There are soem KB articles about this.  Otherwise you would need to modify the script I posted to the Downloads section (linked above) to output the data in NS7 format.  The added benefit is you can use the script directly as the custom inventory, and not have to worry about the .XML file to gather the data.