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

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL