Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Redirect StdOutput failure 2>&1

$
0
0

I know I saw a video once on this but I don't remember what the trick is when using PowerShell. 

PS T:\> Get-Service -Name UPS 2>&1 C:\scripts\outputx.txt
Get-Service : A positional parameter cannot be found that accepts argument 'C:\scripts\outputx.txt'.
At line:1 char:12
+ Get-Service <<<<  -Name UPS 2>&1 C:\scripts\outputx.txt
    + CategoryInfo          : InvalidArgument: (:) [Get-Service], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetServiceCommand

How do I get all the output, warnings, verbose, everything to go to C:\Scripts\output.txt

 


Viewing all articles
Browse latest Browse all 10624

Trending Articles