vefkid.blogg.se

Powershell script to monitor folder for new files
Powershell script to monitor folder for new files







powershell script to monitor folder for new files

Write-host "User logged in but Onedrive is not running!"Įlseif ($state -eq "True" -and $difference -le 24 -and $unt -gt 0 -and $checkprocess -match "True") Skipping OneDrive monitoring."Įlseif ($checkprocess -eq $false -and $userloggedin -eq $true) Write-host "No azuread user is logged on. $TimeSpan = new-timespan -start $datumnow -end $convertdate $files = Get-ChildItem -Path $folderMask -Filter SyncDiagnostics.log | Where-Object $folderMask = "C:\Users\*\AppData\Local\Microsoft\OneDrive\logs\Business1\*.*" #Search onedrive logs in the user folders I need to test it some more… but here it is. Of course, this is my first beta script so it’s not perfect yet. When using Solarwinds you can create some PowerShell scripts to begin monitoring OneDrive. Compare current time and the Timestamp to get the difference.So now we have some information to begin monitoring but we still need to check some other information. Or the value: syncprogressstate, just does not exist….After some tests to break OneDrive I noticed some things. So getting the error codes can be a little bit hard. It’s a funny thing, syncprogressstate is nowhere mentioned in Microsoft’s documentation. This syncdiagnostic.log will show you some important things.

powershell script to monitor folder for new files

Luckily there is some kind of log file in the user’s local AppData folder.

powershell script to monitor folder for new files

Monitoring your user’s OneDrive can be a true pain because there are no event logs or register values you can monitor to make sure OneDrive is working. I will show you the 2 options you have to start monitoring OneDrive on your endpoints How I Learned to Stop Worrying and Love OneDrive









Powershell script to monitor folder for new files