Let's say I have the following PowerShell source:
PowerShell shell = PowerShell.Create().AddCommand("Get-NetAdapter")
.AddParameter("name", "Ethernet*")
.AddParameter("ThrottleLimit", 5);
Now, before call shell.Invoke(), I want check, for logging purposes, the final command line. In this case I expect something like
Get-NetAdapter -name Ethernet* -ThrottleLimit 5
I tested these, but none works:
shell.Commands.ToString()
shell.Commands.Commands.ToString()
shell.Commands.Commands.First().CommandText
shell.Commands.Commands.First().ToString()
Is there some built in way to check the final command line?