How can I search for a missing PATH entry using a custom inventory rule?
Hello,
I'm new to the forum, so please let me know if I miss any pertinent information.
I've isolated the registry key: HKLM\System\CurrentControlSet\Control\Session Manager\Environment
I'm unsure what logic I can use within the k1000 custom inventory rule prompt to find these systems. If there is another post dedicated to custom inventory rules please let me know and I will post there instead (I didn't see one when I searched).
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
SMal.tmcc
9 years ago
The easiest was you can do this is
ShellCommandTextReturn(set path)
Then create a report that has a filter using your cir contains ;%systemroot%\system32;
Also when I checked my machine my path is ;c:\windows\system32; not %systemroot%
If you want it to show just that entry to be the only path portion in the cir you would need to pipe this command into a for do loop to filter for that.
Comments:
-
The shell command I have used to check for C:\windows system32 is [code] echo.%path% | findstr /i /c:"c:\windows\system32;" [/code] and outputs a 0 on find or a 1 on fail. Will the cir understand the 0/1? - Proto84 9 years ago
-
thanks, my bad got mixed up in my head, pipe to a findstr not a for do loop since they are only looking for a single return - SMal.tmcc 9 years ago
Posted by:
SMal.tmcc
9 years ago
Posted by:
SMal.tmcc
9 years ago
I think it is best just to do what I originally said and ShellCommandTextReturn(set path) and create a report with a filter that CIR is not null and CIR does not contain ;c:\windows\system32;
I came up with this and as a batch file it runs great, only returns the error level of 0 or 1
Anyway here is the cir you have in mind but since ShellCommandTextReturn records all steps of the process you are still stuck with the %path% in the cir.
I came up with this and as a batch file it runs great, only returns the error level of 0 or 1
echo off & echo %path% | find /i "c:\windows\system32;" & cls & echo %ERRORLEVEL%you could create a batch file attach it to the cir and then use a MI to install the batch to your machines and then call the batch file with a ShellCommandTextReturn CIR and it will give you just the 0 or 1 state. I do something like that to get a clean list of admins on my systems.
Anyway here is the cir you have in mind but since ShellCommandTextReturn records all steps of the process you are still stuck with the %path% in the cir.
shellcommandtextreturn(cmd /q /c echo %path% | find /i "c:\windows\system32;" & cls & echo %ERRORLEVEL%)and you get this