I am trying to create a custom inventory rule to list the computers logon server. I have tried several ways with no luck.

Most recent try was: ShellCommandTextReturn(cmd /c \"nltest /dsgetdc:domain.local").



Answer Summary:
1 Comment   [ - ] Hide Comment


  • Thanks Steve! That is exactly what we needed. Worked like a charm. Thanks for the quick response.
  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
Please log in to comment

Community Chosen Answer



Answered 01/29/2014 by: SMal.tmcc
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity



How about a software inventory item with a custom inventory rule containing:

ShellCommandTextReturn(cmd.exe echo %logonserver%)


I haven't tried this in my environment. So this is just a quick answer that comes up.

Answered 01/29/2014 by: KevinF
Senior Yellow Belt

  • I tried that, it runs as system so it never gets populated properly.
    • Thanks, haven't had a chance to try yet. The way SMal.tmcc posted works occasionally. Sometimes the text file will have the domain controller in it and other times it just has %logonserver% in the file. Haven't had much time to look at it yet, but seems like the way to go for now.

      • not sure why that is happening to you but have done more testing and looks like you can you use wmic to get this info without creating a file. most likely will not return much if logged in locally
Please log in to comment

That is a user volatile env variable so it is hard to get with a custom inventory since they run as system.

[HKEY_CURRENT_USER\Volatile Environment]

the easy way to do this would be run a daily script as the logged in user that creates a txt file and then have a custom inventory read that file.  You can use the echo command since this is a varaible.

se item 4 of my custom inventory


Answered 01/17/2014 by: SMal.tmcc
Red Belt

Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja