Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2.  
  3. Unregister-Event -SourceIdentifier FileCreated
  4.  
  5. $folder = 'c:\users'
  6. $filter = 'TEMP'
  7. $fsw = New-Object IO.FileSystemWatcher $folder, $filter
  8. $fsw.IncludeSubdirectories = $true
  9. $fsw.NotifyFilter = [IO.NotifyFilters]'DirectoryName' # just notify directory name events
  10. $onCreated = Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action { Write-EventLog -LogName "Application" -Source "SceCLI" -EventID 666 -EntryType Error -Message "C:\Users\TEMP" -Category 1 -RawData 10,20 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement