=========================================
$ErrorActionPreference = "SilentlyContinue";
Stop-Transcript | out-null
$Archivolog = "C:\temp\output-$(get-date -f yyyy-MM-dd_hh-mm-ss).txt"
$Archivolog2 = "C:\temp\compress-logfiles-$(get-date -f yyyy-MM-dd_hh-mm-ss).txt"
Start-Transcript -path $Archivolog -append
$criteria = Minidump*.dmp
Write-Host Step Delete MINIDUMP FILEs Start at $(get-date)
$mindump = gci c:\test1 -recurse -Include "$criteria"
if ($mindump -eq $null) {write-host *** No files found to delete ***} else {write-host List of files to delete:; $mindump | % {write-host $_}}
remove-item $mindump -force
$mindump | % {If(test-path $_){ write-host $_";File NOT DELETED"} else {write-host $_";File DELETED"}}
Write-Host Step Delete MINIDUMP FILEs Finished at $(get-date)
Stop-Transcript
$text = [IO.File]::ReadAllText($Archivolog)
New-EventLog –LogName Application –Source "Nakama test"
Write-EventLog –LogName Application –Source "Nakama test" –EntryType Information –EventID 9213 –Message $text
=========================================
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment