I'm new to the forum, so please let me know if I miss any pertinent information.

My goal is to create an inventory of systems missing the %systemroot%\system32; entry in the default Windows %PATH% environment variable. 
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


Please log in to comment

Community Chosen Answer

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.

Answered 10/07/2015 by: SMal.tmcc
Red Belt

  • 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?
    • 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
      • My question now is will this inventory rule only give me computers that give a return 0?
      • On a machine you have run this on, does the CIR show under the machines details "custom inventory fields"? it should be a 1 or 0 in that detail.
Please log in to comment


I tried your findstr and it returned a lot of stuff, I have some time to test now will post back a working one shortly

your findstr CIR

Answered 10/07/2015 by: SMal.tmcc
Red Belt

Please log in to comment
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

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


Answered 10/07/2015 by: SMal.tmcc
Red Belt

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