Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

If Else Statement

$
0
0

I am this If Else statement that is giving me some trouble. 

     If (($User.Activate -eq 'Y') -and ($User.employeeType -eq 'Student')) {Set-ADUser $User.sAMAccountName -AccountExpirationDate $Null}
   

    Elseif (($User.Activate -eq 'Y') -and ($User.employeeType -eq 'Employee')) {Set-ADUser $User.sAMAccountName -AccountExpirationDate $Null}
   

 Else {Write-Host "Nothing Happened"}
}

I am trying to match to variables and that is not working.  I am just getting the "Nothing Happened".  I've searched and from what I can find the variable matching should be correct.  

Any ideas?


Viewing all articles
Browse latest Browse all 6937

Trending Articles