powershell - IF/ELSE Get-SPWeb -
i trying check whether web site exists. seem have error in if
statement, i'm not sure of correct syntax. here's code:
$urlis = "https://ourdevsite.dev.com/sites/flibidyboots" add-pssnapin microsoft.sharepoint.powershell -ea 0 if ((get-spweb $urlis) -ne 0){ write-host "site not exist, can proceed building it" -foregroundcolor green } else { write-host "site exist, need pick url" -foregroundcolor red }
what did wrong?
ok, first of $null, not 0. , second, if not $null exists, cases mixed up.
Comments
Post a Comment