param ([string]$folder,
$Icon = "$env:SystemRoot\system32\appverif.ico"
)
$form = new-object System.Windows.Forms.Form
$ni = new-object System.Windows.Forms.NotifyIcon
$niMenu = new-object System.Windows.Forms.ContextMenu
$watcher = New-Object System.IO.FileSystemWatcher $folder
$ni.Icon = New-object System.Drawing.Icon($Icon)
$ni.ContextMenu = $niMenu
$miExit = new-object System.Windows.Forms.MenuItem
$miExit.Text = "Exit"
$miExit.Add_Click({ $ni.Visible = $False
$form.close() })
$niMenu.MenuItems.AddRange(@($miExit))
$watcher.IncludeSubDirectories = $true
$watcher.SynchronizingObject = $form
$form.ShowInTaskbar = $False
$form.WindowState = "minimized"
$watcher.NotifyFilter = [System.IO.NotifyFilters]::LastAccess , [System.IO.NotifyFilters]::LastWrite, [System.IO.NotifyFilters]::FileName,[System.IO.NotifyFilters]:

irectoryName
$watcher.add_Changed({
Write-Host "$((get-date).ToShortTimeString()) : $($_.FullPath) $($_.ChangeType)"
})
$watcher.add_Created(
{Write-Host "$((get-date).ToShortTimeString()) : $($_.FullPath) $($_.ChangeType)"
})
$watcher.add_Deleted({
Write-Host "$((get-date).ToShortTimeString()) : $($_.FullPath) $($_.ChangeType)"
})
$watcher.add_Renamed({
Write-Host "$((get-date).ToShortTimeString()) : $($_.OldFullPath) renamed to $($_.FullPath) $($_.ChangeType)"
})
$watcher.EnableRaisingEvents = $true
$NI.Visible = $True
$form.showdialog()