title: Powershell Out-file with variable
body: <p>I'm trying to write a script that will check if a string is null and if it is output the user name to a file so I can go back and check that file and see who is null.  Below is my code, the script is not writing to the out-file any ideas?</p>
  
  <pre><code>$user = "user@domain.com"
  #just gets the users info
  $user_info = gam info user $user 
  $suspended = $user_info | Select-String -pattern "Account Suspended: true"
  if ($suspended = $null) {
    $user | Out-File -FilePath C:\scripts\not_suspended.txt -append -Encoding utf8
    }
  </code></pre>