Get-ADComputer Description
i'm trying create script prompt user enter part of description of computer in ad , display only description property of matches. after researching it, i've come this:
get-adcomputer -filter {description -like "*steve*"} -properties description
which runs great except need manually enter criteria , displays 9 other properties in addition description (which want)
so pull in user input, figured i'd try this:
$a = read-host "enter first name:"
get-adcomputer -filter {description -like "*$a*"} -properties description
when type name in input box, returns nothing.
$a = read-host "enter first name:" get-adcomputer -filter "description -like '*$a*'" -properties description | select -expandproperty description
Windows Server > Windows PowerShell
Comments
Post a Comment