I am looking for the best way to check if a Com Object exists.
Here is the code that I have; I'd like to improve the last line:
$ie = New-Object -ComObject InternetExplorer.Application $ie.Navigate("http://www.stackoverflow.com") $ie.Visible = $true  $ie -ne $null #Are there better options? 
                I would stick with the $null check since any value other than '' (empty string), 0, $false and $null will pass the check: if ($ie) {...}.
You can also do
if ($ie) {     # Do Something if $ie is not null } 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With