Hi,
as in many organizations we have people with an ADM account.
I would also like to include these in our offboarding process and I’m running into problems with the following:
[pre class=“decode:true”]
$user =“paul.adm”
if(!($user -contains “.adm”)){
$department = (get-aduser $user -properties department).department
}Else{
$user = $tempuser.split(“.”)
$department = (get-aduser $tempuser[0] -Properties department).department
}
$department
[/pre]
if I run the above mentioned code my department remains empty
If I run the else part of my if statement then this works correctly and gives me the department name.
what is the reason that it doesn’t work in my if statement?
thanks for your help
Paul