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

AD objects have $ symbols as leading character

$
0
0

Hi,

I hope this is the correct place to ask this question

I am fairly new to PowerShell and am trying to perform a Get-ADComputer lookup on a specific OU in my domain, however the OU's are named $Servers for example.

So when I run...
Get-ADComputer -LDAPFilter "(name=*)" -SearchBase "CN=$Servers,DC=contoso,DC=com"

I receive the following error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ADComputer], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:8335,Microsoft.ActiveDirectory.Management.Commands.GetADComputer

I have tried some other ways of presenting the value such as `$Servers to no avail.

Can anyone advise how to do this.

Many thanks.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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