(GSV).Name|%{If($_ -like "*net*"){ $_ ; Break }};Pause
When I run the above line from a PowerShell window, "Netlogon" will be output.
When I run a PS1 file that contains the same line, a PowerShell window will appear and then disappear immediately, and nothing will be output.
What is wrong with that line?