Rescan OwnCloud Files Through PowerShell

The open-source project OwnCloud is a great alternative to Dropbox, Box, or other file-sharing and syncing sites if you need to keep control of your data in-house.  I've been managing a few installs of it since version 4, and while the online management tools have come a long way, there are still a few things that need to be done from the command line.

Here's a PowerShell script I came up with to trigger a rescan of a user's files when needed (if I've had to clean out files or restore them from a backup).  Hope someone finds this useful.

## Configuration Options 
$phpPath = "C:\path-to-php\" 
$phpExec = "php.exe" 
$ownCloudPath = "D:\path-to-owncloud-web\" 

$userName = Read-Host "What user should be rescanned? (Leave blank to rescan all users)" 
if (-not ($userName)) { $userName = "--all" } 

$command = $phpPath + $phpExec + " " + $ownCloudPath + "console.php files:scan " + $userName 

iex $command