title: Get-Date Error in AD Password Expire reminder
body: <p>this is part of a code that reminds users if their active directory password is about to expire.</p>
  <p>It used to work, but now I get this error out of a sudden! Maybe because the Local Machine Language is German with German Date Format, but I don't know hot to fix it! I would really appreciate the help.</p>
  <p>The Code:</p>
  <pre><code>#Calculate expirering passwords and store them in an object
  $today = (get-date).date
  
  [Threading.Thread]::CurrentThread.CurrentUICulture = 'en-US';
  
  $ExpirePasswordList =
  foreach ($ADUser in $AllADUsers) {
      $PasswordLastSet          = $ADUser.PasswordLastSet
      $PasswordExpireDate       = (get-date $PasswordLastSet).AddDays($MaxPasswordAge)
      $DaysBeforePasswordchange = (New-TimeSpan -start $today -end $PasswordExpireDate).days
      
      if ($DaysBeforePasswordchange -le $WarningLevel) {
          [pscustomobject]@{
              Givenname                = $ADUser.GivenName
              Surname                  = $ADUser.Surname
              MailAddress              = $ADUser.mail
              DaysBeforePasswordchange = $DaysBeforePasswordchange
              PasswordExpireDate       = $PasswordExpireDate 
          }
      }
  }    
  </code></pre>
  <p>The Error:</p>
  <pre><code>Get-Date : Cannot bind parameter 'Date' to the target. Exception setting &quot;Date&quot;: &quot;Cannot convert null to type &quot;System.DateTime&quot;.&quot;
  At line:6 char:43
  +     $PasswordExpireDate       = (get-date $PasswordLastSet).AddDays($ ...
  +                                           ~~~~~~~~~~~~~~~~
      + CategoryInfo          : WriteError: (:) [Get-Date], ParameterBindingException
      + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.GetDateCommand
  </code></pre>