i want to know what PCs are running Spotify on my network. Unfortunately, Spotify does not create an entry in Program files but rather in AppData\Roaming. Is there any way to create a custom inventory rule to scan that area and if a word is found (like spotify) have that appear in the inventory?

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

2

so i found the location of the program folder

 

C:\Users\xxxx\AppData\Roaming\Spotify

and I ran a test on my own machine and was able to get it to detect mine but thats only because I put the location as mine. What do i need to do to make the "xxx" be all user profiles?

Answered 09/24/2012 by: dkurz8814
Fourth Degree Green Belt

  • Will %username% work there?
  • i will try and report back..
  • so far changing that to %username% has not worked ( did a forced inventory update on a few machines i know the rule to be true and so far the software is not reflecting those changes, nor is the inventory item being changed in any way)
Please log in to comment
2

I use a recursive lookup .bat for items like this. I've never tested in %appdata%, but you should be able to tweak it. Just export the results to a .txt file and have Kace inventory it.

PUSHD "%appdata%\"

FOR /f "tokens=1-8 delims=\" %%a IN ('DIR /b /s "FIRST.EXE"') DO ECHO %%a\%%b\%%c\%%d\%%e\%%f\%%g\%%h

POPD

PUSHD "%appdata%\"

FOR /f "tokens=1-8 delims=\" %%a IN ('DIR /b /s "SECOND.EXE"') DO ECHO %%a\%%b\%%c\%%d\%%e\%%f\%%g\%%h

POPD

PUSHD "%appdata%\"

FOR /f "tokens=1-8 delims=\" %%a IN ('DIR /b /s "THIRD.EXE"') DO ECHO %%a\%%b\%%c\%%d\%%e\%%f\%%g\%%h

POPD
 
Answered 09/24/2012 by: dugullett
Red Belt

Please log in to comment
1

You could also use the Metering aspect of the KBOX and see if anyone is running the spotify executable. That will tell you if anyone on your network is using the application. 

Answered 09/24/2012 by: nshah
Red Belt

  • Unfortunately that just tells me who is currently running it. I want to know where it is installed-regardless of whether or not it is running. I am going to keep playing with the custom inventory rules since I was able to get it to detect my machine , so i know it can look there-its just a matter of finding out what variable I need to use..
Please log in to comment
1

Try this custom inventory rule then force your client to check in.  After that go into the machine inventory and you should see it listed under Software -> Custom Inventory Fields.  If you see that, look under "Installed Programs"

FileInfoReturn(c:\spotify\spotify.exe, modification_time, DATE)

Answered 09/25/2012 by: dmaximoff
Orange Senior Belt

  • good news it found 4 people-bad news is it seems to also be finding false positives. Can I ask you to confirm how I interpret your code?

    You are asking it to return file data from the directory C:\spotify\spotify.exe?

    I am not a script guy so i am kind of a bit in the dark here and I am confused because spotify does not create such a directory.

    everyone's help has been greatly appreciated.
  • You are correct, in my example it is looking at the directory "c:\spotify". Change the path in the example to the exact path that spotify.exe is located.
    I'm not sure how it would have false positives. What kind of information is it returning in this case?

    Here's a breakdown of the custom inventory rule. "FileInfoReturn" specifies to look for a file and return results back to the K1000. "c:\spotify\" is the directory to look in and "spotify.exe" is of course the file to look for. The last two items are what info to return to the K1000.

    Hope this helps
Please log in to comment
1

Custom inventory rules will look for a file and find it. However, programs such as spotify and dropbox tend to only reside in the users profile.  Therefore when a different user logs in that does not have the program installed the inventory rule will not find it.  I wrote the following script to create a txt document if "spotify.exe" is found anywhere within "documents and settings".  If it is removed, the txt document will be deleted.  Just set the custom inventory rule use FileExists(c:\windows\temp\spotdetected.txt)

@echo off
dir "c:\documents and settings" /s /b | find /i "spotify.exe" > c:\windows\temp\lookingforspot.txt
Find /n /i "spotify" c:\windows\temp\lookingforspot.txt
IF errorlevel 1 goto notfound
echo found > c:\windows\temp\spotdetected.txt
goto end
:notfound
if exist c:\windows\temp\spotdetected.txt del c:\windows\temp\spotdetected.txt
if exist c:\windows\temp\lookingforspot.txt del c:\windows\temp\lookingforspot.txt
:end

 

IF you want this .bat to run completely silent call it using this .vbs script

Set WshShell = CreateObject("WScript.Shell")
cmds=WshShell.RUN("c:\windows\temp\findspot.bat", 0, True)
Set WshShell = Nothing
Answered 10/17/2012 by: j1e0
White Belt

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