Closed DungKHoang closed 1 year ago
This is not a bug. You need to use the -Append
parameter switch. If you do, the PS1 script will be saved with all of the pipeline output and not overwrite the file contents.
The correct command syntax would be:
Get-OVNetwork -ApplianceConnection $session | ConvertTo-OVPowerShellScript -Export c:\net.ps1 -Append
Thanks! Would it be nice to have this example in the help file /DHK
Expected Behavior
Use the command to generate PowerShelll script for objects returned from the pipeline
Expect the PS1 script has all the network objects from the pipeline
Actual Behavior
The command creates a script for the last object from the pipelin
Correct syntax
To get the full PS1 script, you should do: Get-OVNetwork -ApplianceConnection $session | %{ ConvertTo-OVPowerShellScript -Export c:\net.ps1 -append -InputObject $_}
Steps to reproduce