I am wondering if this is by design or not.
Writing a script to format disks remotely by using a PsSession. Of course, I first try the script locally without a PsSession:
Get-Disk |
Where PartitionStyle -eq 'RAW' |
Initialize-Disk -PartitionStyle GPT -PassThru |
New-Partition -UseMaximumSize |
Format-Volume -FileSystem NTFS -Confirm:$false
Works fine.
After it completes, I run Clear-Disk to start all over. I go to another machine (same OS level), open a PsSession, and start typing in the commands. I enter the first two lines as one - Get-Disk | Where PartitionStyle -eq 'RAW' |
But when I enter a carriage return after the pipe symbol, I get this error message:
An empty pipe element is not allowed.
I thought the idea of a PsSession was to create an evironment to execute commands in the same manner as if I were executing them from on that other machine. Is there a difference in the design model?
Yes, I understand I could put the entire piped command on a single line, but I like to try to make things a little easier to read without scrolling back and forth all the time. So this is not a critical error. I'm just curious.
Thanks for the insights.
.:|:.:|:. tim