/build/static/layout/Breadcrumb_cap_w.png

Custom inventory rule for logged in user

I'm trying to create a custom inventory rule to display the contents of %LOCALAPPDATA%\Microsoft\Outlook. The problem that I am finding is that it is running as the KACE system process and doesn't display the correct information. Any ideas on this one? 

Here is my command: ShellCommandTextReturn(cmd /c dir %LOCALAPPDATA%\Microsoft\Outlook)

1 Comment   [ + ] Show comment
  • CIR's run as system that is why you have problems getting the logged in users info - SMal.tmcc 4 years ago

Answers (4)

Posted by: SMal.tmcc 4 years ago
Red Belt
2
you can modify this blogs commands to to a dir instead of a DO net localgroup

http://www.itninja.com/blog/view/kace-script-to-give-local-admin-rights-to-logged-in-user-in-windows

DO dir C:\Users\%%g\AppData\Local\Microsoft\Outlook
Posted by: flip1001 4 years ago
Black Belt
2
Try this for a CIR, but it will only work if a domain account is in session as far as I can tell.

ShellCommandTextReturn(cmd /q /c for /f "tokens=2 delims=\" %a in ('wmic computersystem get username') do for %A in (%a) do if exist "C:\Users\%A\AppData\Local\Microsoft\Outlook\." (dir "C:\Users\%A\AppData\Local\Microsoft\Outlook"))


Comments:
  • what does this do in this directory
    do if exist "C:\Users\%A\AppData\Local\Microsoft\Outlook\

    we use lotus notes in our company..any options like above you have mentioned to find the user details from lotus notes that is synced/stored locally in user profiles?

    i want to find user info's from Lotus notes if it stores any details locally - rahimpal 4 years ago
    • If the Outlook folder exists then the dir command is run to output the contents and some attributes of that folder.

      I have no knowledge of Lotus Notes. - flip1001 4 years ago
Posted by: chucksteel 4 years ago
Red Belt
1
I would recommend creating a script that detects the current logged in user and gathers the data you want then outputs it. You can then have your custom inventory rule run that script. This code will create a user variable for the current logged in user:
for /f "tokens=8" %%a in ('tasklist /v ^|find "explorer.exe"') do (
set "user=%%a")

One caution: If a machine runs an inventory update when a user isn't logged into a computer then this won't return any results and that would interfere with the collection of your data.

Posted by: rockhead44 4 years ago
Red Belt
0
There is an extra \M in what you posted as your command. Is that a typo in your post or is that how you have the CIR?

Comments:
  • err thanks for pointing that out. It was just a typo in my post. - patackyc 4 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ