Managed Installation and Custom Inventory for OneDrive
06/29/2016 1568 views
OneDrive for Business shows up under Discovered Software and not Installed Programs. How can I write a Custom Inventory Rule so I can add OneDrive to the Software list, attach our OneDrive installation package and roll it out through Managed Installation? If I could write a rule that looked at the Application ID in the Software Catalog, that would work. Looking at the documentation, I can't see how any of the possible rules will find it.
OneDrive DOES show up for Mac computers, but not Windows PCs.
OneDrive 17.x (current major version) DOES show up in the Software Catalog and reports all the minor versions and number of computers with it installed.
The executable is located in the user's AppData folder - c:\Users\[username]\AppData\Local\Microsoft\OneDrive.exe which makes it difficult to write a rule for file and version. I tried using FileVersionGreaterThan(c:\users\%username%\appdata\local\Microsoft\OneDrive\OneDrive.exe,17.3) and FileVersionGreaterThan(%LocalAppData%\Microsoft\OneDrive\OneDrive.exe,17.3) but both come back with 0 instances. I checked the file itself and it is versioned 17.3.x.x
Windows 7 shows OneDrive and version 17.3.x.x in Programs and Features as an installed program. Windows 10 does not since it is essentially built-in but it also doesn't show up in Turn Windows Features On or Off
Answer Chosen by the Author
Please log in to answer
As Flip1001 commented, there is a way to find the executable. I ended up using a slightly more complicated string that I modified from another user looking for the Outlook folder in AppData. Here was what I used checking for the exact location rather than anywhere in the users folder.
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\OneDrive\OneDrive.exe" (dir "C:\Users\%A\AppData\Local\Microsoft\OneDrive"))
Answered 06/30/2016 by: swalker804