title: How to check existence of hashtable key as well as value not null/empty/whitespace at once
body: <p>When I want to <strong>check all these things at once</strong> in a condition of a PowerShell script:</p>
  
  <ol>
  <li>Check for the existence of a hashtable key</li>
  <li>Check that the keys value is not NULL</li>
  <li>Check that the keys value is not empty string</li>
  <li>Check that the keys value is not just whitespace</li>
  </ol>
  
  <p>I am doing it like this:</p>
  
  <pre><code>$properties = @{ first = 'A'; second = ''; third = 'C' }
  
  if (![string]::IsNullOrWhitespace($properties.first)) {
      Write-Host "Value of key 'first' is: $($properties.first)"
  }
  if (![string]::IsNullOrWhitespace($properties.second)) {
      Write-Host "Value of key 'second' is: $($properties.second)"
  }
  if (![string]::IsNullOrWhitespace($properties.fourth)) {
      # This does not fail 
  }
  </code></pre>
  
  <p>Output: </p>
  
  <pre>
  Value of key 'first' is: A
  </pre>
  
  <p>Obviously it works even for not existing keys. But I am <strong>curious if there is a better or cleaner way</strong> to do it?</p>