Question: I'm working on a Mssql install script and I want to get the results of a silent mssql installation. In my PowerShell script I run this command:

```
$result = (start cmd "/c D:\SQL2008R2\SQL2008R2\setup.exe /CONFIGURATIONFILE=sqlconfig.ini && exit 0 || exit 1")

```

Which should return 0 on fail and 1 on pass. Unfortunately, I don't get any output back. Any ideas?

Answer: 
This is how you do it: `start` is actually an alias `Start-Process`, so you have to look at *it's* documentation, which is a lot different than cmd.exe's `start`. So you can do this:

```
(Start-Process -FilePath "cmd.exe /c ..." -Wait -Passthru).ExitCode

```

So easy!
Too late maybe but does this help?

```
start /WAIT cmd.exe /C "YOUR-COMMAND-HERE" & if errorlevel 1 echo 'error occurred'

```

you can also explicitly return an error code like this:

```
start /WAIT cmd.exe /C "YOUR-COMMAND-HERE & exit MY-ERROR-CODE" & if errorlevel 1 echo 'error occurred'

```