Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Find a computer in AD using Get-ADComputer -Filter

$
0
0

I use the following to find a computer in AD and works fine.

Get-ADComputer -Filter "name -eq 'pcname'"

But I need to use $pc = "pcname" first before searching it like below but it does not work. How to do that ? thanks.

 $pc = "pcname"

Get-ADComputer -Filter "name -eq $pc"


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>