-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
PowerShell 7 Workshop
By :
We’ve done a lot of work in this chapter, so now it’s time to kick back and have some fun with Trace-Command. At least, I think it’s fun; other opinions are available. This cmdlet does, however, really let us get into the nuts and bolts of how PowerShell works so that we get to see it in action.
Run the following code:
Trace-Command -Name ParameterBinding -Expression {New-Object -TypeName PSObject -Property @{'Id' = (Get-Random)} | Stop-Process -WhatIf} -PSHost Here, we’re running Trace-Command and asking it to record ParameterBinding events. We’re giving it the cmdlet we ran previously as an expression in a script block, and then with -PSHost, we’re telling it to output to the screen, rather than its default, which is the debug stream that we saw right at the start of this chapter when we were talking about streams.
We’ve now got a screen full of yellow writing...
Change the font size
Change margin width
Change background colour