I’m not sure if the ‘Tips & Tricks’ thread on this cmdlet is relevant for this issue, but I’m basically trying to get STDOut from this PSADT cmdlet.
I’ve tried a few different things, but basically I want to store the output from a command to a variable, then make an if/else statement based on the output of that variable.
$SqlLocalDBStatus = Start-ADTProcessAsUser -FilePath “sqllocaldb” -ArgumentList “i” -PassThru
Is essentially what I’m trying to do, I’d like to see the output of the sqllocaldb i
command. The command runs, but I don’t get the STDOut in the variable.
I’ve tried with and without PassThru
, with and without Wait
, with and without NoRedirectOutput
and with and without OutputDirectory
as well as combinations of all of the above.
I’m also a little confused, the PassThru
param in the documentation states
If NoWait is not specified, returns an object with ExitCode, STDOut and STDErr output from the process. If NoWait is specified, returns an object with Id, Handle and ProcessName.
But there is not a NoWait
param - there is Wait
and WaitOption
- so I’m not sure if I’m just flat out doing something wrong, if the documentation is outdated, if there’s a bug…
I’ll try with v3, but I’ve never tried to do this before with PSADT.