I want a Custom Inventory rule in the K1000 that will return just the second line of an ini file. Is that possible?
It seems like this should be possible with ShellCommandtextreturn, but I am not sure how. The file opens in notepad. Can anyone point me in the right direction?
Thank you,
awingren
Answers (1)
Do you really want the second line of an ini file or are you looking for a certain value (that's normally on the second line)? If you're looking for a value then you can use the findstr command:
findstr MAPI= c:\windows\win.ini
If you really want to grab the second line then I'm not sure how you could do that without a full batch file or vbscript. If that's the case then you might need to run a script that will create a file with the data you need and then have the custom inventory rule read that file.
Comments:
-
Hi Chucksteel! Thank you for your response!
findstr should do the trick. The string I'm looking for is WorkstationType=
I tried:
ShellCommandTextReturn(findstr /c:WorkstationType /f:%ProgramFiles%\Sentillion\Vergence Authenticator\Authenticator.ini)
and
ShellCommandTextReturn(findstr WorkstationType=%ProgramFiles%\Sentillion\Vergence Authenticator\Authenticator.ini)
Neither option returns anything. Here's the output of kinventory.log:
[Thu Dec 05 14:36:37 2013] KInventory Begin capturing Inventory...
[Thu Dec 05 14:36:37 2013] KInventory InventoryData attempting to open DB file [C]
[Thu Dec 05 14:36:37 2013] KInventory InventoryData opening DB
[Thu Dec 05 14:36:37 2013] KInventory InventoryData calling db.open
[Thu Dec 05 14:36:37 2013] KInventory InventoryData opened DB successfully
[Thu Dec 05 14:36:37 2013] KInventory InventoryData populated the DB
[Thu Dec 05 14:36:37 2013] KInventory Now gathering Version information...
[Thu Dec 05 14:36:37 2013] KInventory Now gathering Process information...
[Thu Dec 05 14:36:37 2013] KInventory Now gathering BIOS information...
[Thu Dec 05 14:36:37 2013] KInventory Now gathering OperatingSystem information...
[Thu Dec 05 14:36:37 2013] KInventory --skipping 'OSArchitecture' (not found)
[Thu Dec 05 14:36:37 2013] KInventory --skipping 'OSFamily' (not found)
[Thu Dec 05 14:36:37 2013] KInventory Now gathering ComputerSystem information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering MotherboardDevice information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering SoundDevice information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering CDROMDrive information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering VideoController information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering DesktopMonitor information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering Registry information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering NetworkAdapter information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering NetworkAdapterConfiguration information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering Printer information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering StartupCommand information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering PhysicalMemory information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering PhysicalMemoryArray information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering InstalledSoftware64 information...
[Thu Dec 05 14:36:38 2013] KInventory Now gathering InstalledSoftware32 information...
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:38 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'I' for 'D'
[Thu Dec 05 14:36:39 2013] KInventory Now gathering UserAccount information...
[Thu Dec 05 14:36:39 2013] KInventory Error: InventoryData AddItem : Could not find map in 'U' for 'N'
[Thu Dec 05 14:36:39 2013] KInventory Now gathering QuickFixEngineering information...
[Thu Dec 05 14:36:39 2013] KInventory Now gathering Services information...
[Thu Dec 05 14:36:40 2013] KInventory Now gathering OptionalFeature information...
[Thu Dec 05 14:36:40 2013] KInventory Now gathering Subcomponents information...
[Thu Dec 05 14:36:41 2013] KInventory Now gathering ServerFeature information...
[Thu Dec 05 14:36:41 2013] KInventory Now gathering Processor information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering WindowsProductActivation information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering SoftwareLicensingProduct information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering PortableBattery information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering SystemEnclosure information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering LogicalDisk information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering DiskDrive information...
[Thu Dec 05 14:36:42 2013] KInventory --skipping 'SerialNumber' (not found)
[Thu Dec 05 14:36:42 2013] KInventory --skipping 'FirmwareRevision' (not found)
[Thu Dec 05 14:36:42 2013] KInventory Now gathering DiskPartition information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering DiskDriveToDiskPartition information...
[Thu Dec 05 14:36:42 2013] KInventory Now gathering LogicalDiskToPartition information...
[Thu Dec 05 14:36:42 2013] KInventory Now creating inventory report...
[Thu Dec 05 14:36:44 2013] KInventory Warning: The type of processor(s) may have been reported incorrectly by Windows. You should download and install Hotfix KB953955 (http://support.microsoft.com/kb/953955/) from Microsoft.
[Thu Dec 05 14:36:45 2013] KInventory Inventory Capture completed and stored in C:\Documents and Settings\All Users\Dell\KACE\\inventory.xml
[Thu Dec 05 14:36:45 2013] KInventory ----- Ending KInventory.exe (0)----- - awingren 11 years ago-
What about
ShellCommandTextReturn(cmd /q /c for /f "tokens=2 delims== skip=1" %a in ('type "%ProgramFiles%\Sentillion\Vergence Authenticator\Authenticator.ini"') do echo %a) - flip1001 11 years ago-
Hi flip1001! Your idea worked... almost! It got me down the right path. I just needed quotes around the file path. Thank you!!!
Final answer:
ShellCommandTextReturn(findstr WorkstationType= "%ProgramFiles%\Sentillion\Vergence Authenticator\Authenticator.ini") - awingren 11 years ago -
Hi Flip1001, to be a bit more specific this is the response I got when I used your suggestion:
C:\>cmd /q /c for /f "tokens=2 delims== skip=1" %a in ('type "%ProgramFiles%\Sentillion\Vergence Authenticator\Authentic
ator.ini"') do echo %a
Private
False
False
USER_AUTHENTICATOR
D4+lJ0a/u8nKAe5pmH+K9g4ej2IabGyh/3LYzHk4ZtIQF129yMz5mToyXQeF7i4qks/LVofvMQXuIPZcXA+vvUi7kZeuPtOLz9K52d2vmbYU1zn3fxcw7efY
vz8evTsDbJbuTgQOZOU/Rn58yK+EnoqqvCQGuaQ8Ud6HB7Skj/yHwFxb+1XOk4z3Kfo6owkC837Qg7XhqAOlDieZRWKmZrI19gmi4wtnvwMpOU0YJYq18eYk
vr+BAwemdwXleEizt+r/XKy4yIlH3uWe8vi5Bpxu8CsCx9czFqvPBn3sOl5wxKdULCpnS+xJLH4FiyLqL2w6l3ayHv465pnxsX1XdhySD6nlb0wVDshxxUrB
9sYr/7g7bAdQ8QBVWBnjEa95E+p3xkdVchgJbT74RSGpgFV3bFqqhVicQzaqNOQ+h/nBhPC4zmHXjenxVPuhVlX+PU2nUSxXgv1bLPnHIvCvKmADz9FUcC1B
00KvJmmnHCNq8pFhNFi3agBnfMO64qPmSsNfu16cIqvdqJRU2De1HNX0zTsp+LlknLYGnMmCS/zKmNG5MDqG/pUHgyCrlp1lJbMEIEeNFKPMQ62vRMnkKyLz
CZ44uukJhSuE3ntSR+TshkRFCBR4SB/lbsvzDpS8SjTSPsQlytwqaKiglOcYPLStyaw4LZt2nKxRAG2o1wLjE6McYjhS3Q
User.Id.Logon.Windows
True
120
False
3
40
user
caseIgnoreMatch
True
3600
360
1
VMCBackground.BMP
900
False
Input
Close
Authenticated User:
2
VMCBackground.bmp
true
VMCHosp
60
VergenceSam.dll
WinNT
VMCLogo.BMP
True
5
False
False
True
True
25
25
hospital
hospital
Sun
vdev-10:389
False
True
ou
ou
True
False
10
5
uid
TRUE
120
It looks like it is spitting out the info after the = sign on every line. This could definitely come in useful in the future! That is more lines than I needed for, but the top line "Private" is the info I wanted to return in the inventory rule. Your suggestion pointed me at using quotes which got my findstr command working. I'm not certain, but it looks like in your code maybe the for loop needs to be told to stop somehow.
Thanks again for all of your help! - awingren 11 years ago
-
I don't think environment variables like %ProgramFiles% work in custom inventory rules. - chucksteel 11 years ago
-
I'm fairly sure the %ProgramFiles% environment variable works for this one and some of my other inventory rules.
Between yours and Flip's suggestions, I got this one working. Thanks chucksteel and flip1001! This community ROCKS! - awingren 11 years ago