Custom Inventory Rule for Logon Server
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").
Thanks,
Jay
-
Thanks Steve! That is exactly what we needed. Worked like a charm. Thanks for the quick response. - jay.moore 10 years ago
Answers (3)
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.
Comments:
-
I tried that, it runs as system so it never gets populated properly. - SMal.tmcc 10 years ago
-
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.
Thanks - jay.moore 10 years ago-
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 - SMal.tmcc 10 years ago
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]
"LOGONSERVER"="\\\\DR-ADS1"
"USERDNSDOMAIN"="TMCCADMN.TMCC.EDU"
"USERDOMAIN"="TMCCADMN"
"USERNAME"="homer"
"USERPROFILE"="C:\\Users\\homer.TMCCADMN"
"HOMEPATH"="\\Users\\homer.TMCCADMN"
"HOMEDRIVE"="C:"
"APPDATA"="C:\\Users\\homer.TMCCADMN\\AppData\\Roaming"
"LOCALAPPDATA"="C:\\Users\\homer.TMCCADMN\\AppData\\Local"
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