Hi guys,
Please help with the following question.
I have the code in my script and it is working.
$servers = (Get-ADComputer -SearchBase "OU=CRMBilling,OU=Servers,OU=KYIV,DC=corp,DC=ukrtelecom,DC=loc" -Filter { OperatingSystem -Like "*Windows Server*" -and dnshostname -like "kv-crm*" })
But if I am using
$ServersFilter = "{ OperatingSystem -Like `"*Windows Server*`" -and dnshostname -like `"kv-crmapp*`"}"
$SearchBaseAD = "OU=CRMBilling,OU=Servers,OU=KYIV,DC=corp,DC=ukrtelecom,DC=loc"
$servers = (Get-ADComputer -SearchBase "'$SearchBaseAD'" -Filter "'$ServersFilter'")
It is not work.
How I can use variables in SearchBase and Filter?