Reputation: 497
Anyone have any idea what this IF command is doing?
Connect-SPConfigurationDatabase -DatabaseName "$configDB" -Passphrase $secPhrase -DatabaseServer "$dbServer" -DatabaseCredentials $dbcreds -ErrorAction SilentlyContinue
If (-not $?)
{
Write-Host -ForegroundColor White " - No existing farm found.`n - Creating config database `"$configDB`"..." }
I'm speculating it's an alternative to :
Try { Do-Something -ea Stop }
Catch { Write-host $_ }
but it's just that, speculation. I've never seen anything like this before and it's not showing up just the once in a script I'm inheriting. It's throwing me right off!
Thanks
Upvotes: 0
Views: 57
Reputation: 32145
$?
is an automatic variable for the error status of the last executed command. See Get-Help about_Automatic_Variables
.
Contains the execution status of the last operation. It contains TRUE if the last operation succeeded and FALSE if it failed.
Upvotes: 3