Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Transcript Logging - Powershell

$
0
0

So here's what I have in my Powershell profile, which I snatched from somebody else here on Spiceworks:

Powershell
## Transcript of session, which is supes useful because I forget shitWrite-Verbose("[{0}] Initialize Transcript"-f(Get-Date).ToString())-VerboseIf($host.Name-eq"ConsoleHost"){$transcripts=(Join-Path$Env:USERPROFILE"Documents\WindowsPowerShell\Transcripts")If(-Not(Test-Path$transcripts)){New-Item-path$transcripts-TypeDirectory|out-null}$global:TRANSCRIPT=("{0}\PSLOG_{1:dd-MM-yyyy}.txt"-f$transcripts,(Get-Date))Start-Transcript-Path$transcript-AppendGet-ChildItem$transcripts|Where{$_.LastWriteTime-lt(Get-Date).AddDays(-14)}|Remove-Item-Force-ea0}

My question is - how can I modify this to run for an actual script? We are writing (more like patching together) a handful of...

Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>