Get-Aduser -Filter will not accept a variable

前端 未结 7 793
挽巷
挽巷 2020-11-22 02:09

I\'d like to check if a user account already exists in the system.

$SamAc = Read-Host \'What is your username?\'
$User = Get-ADUser -Filter {sAMAccountName -         


        
7条回答
  •  长情又很酷
    2020-11-22 02:33

    Little addendum if anyone like me got here and was still tearing their hair out:

    -properties *  
    

    Would be quite a common this to have in this query. Doesn't work, I'm sure someone smarter than me can figure it out

    -properties mail,cn,wtf

    etc does work as expected

提交回复
热议问题