rodneyviana / ODSyncService

OneDrive service/DLL for Sync State
MIT License
93 stars 26 forks source link

Onedrive Monitor change log location #23

Closed dinger1986 closed 3 years ago

dinger1986 commented 3 years ago

Hello,

Can I change the location the logs are? Ideally I want this to run as any user and then monitor it for errors on domains etc. Just getting the newest logs every time, I wrote a script to use with my RMM using the dll but that doesn't work as per the opened bug which is totally cool, would just be good to be able to monitor it globally. For example C:\windows\Logs\ODM\OneDriveMonitor_2021-04-12.log

Thanks

dinger1986 commented 3 years ago

Its ok, figured it out.

Used the following so all good!

$LoggedOnUser =(Get-WmiObject -Class Win32_Process -Filter 'Name="explorer.exe"').GetOwner().User | select-object -first 1

$content = Get-Content -Path "C:\Users\$LoggedOnUser\Appdata\Local\OneDriveMonitor\Logs\OneDriveMonitor_$((Get-Date).ToString('yyyy-MM-dd')).log";