Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 29128

Capturing Write-Noun Cmdlet Output

$
0
0
I’m sure there’s a cleaner way to capture the output from Write-Host, Write-Verbose, etc.  However, I’m just going to “go caveman” in the words of a coworker and just hack around with the Verb-Transcript cmdlets. Without further ado: function Get-MisbehavingCmdletOutput { param ( [System.Management.Automation.Scriptblock]$ScriptBlock = $null, [string]$Path = "$env:temp\$([System.IO.Path]::GetRandomFileName())" ); if (!$ScriptBlock) { write-host "$($MyInvocation.MyCommand...(read more)

Viewing all articles
Browse latest Browse all 29128

Trending Articles



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