Hallo,
Könntet ihr mir zufällig dort weiterhelfen wo der Fehler liegt ?
# Import-Module ActiveDirectory
Import-Module ActiveDirectory
# Set the path for the CSV file
$csvFile = "C:\Test\Contacts.csv"
# Get all contact objects from the Active Directory
$contacts = Get-ADObject -Filter {(objectClass -eq "contact") -and (Path "OU=Consulting,OU=Kontakte,DC=cvn,DC=local")} -Properties name,telephoneNumber
# Create a new object to store the contacts
$contactList = @()
# Loop through the contacts and add them to the contact list
foreach ($contact in $contacts) {
$contactList += New-Object PSObject -Property @{
Name = $contact.name
TelephoneNumber = $contact.telephoneNumber
}
}
# Export the contact list to a CSV file
$contactList | Export-Csv $csvFile -NoTypeInformation
Fehlermeldung:
Get-ADObject : Fehler beim Analysieren der Abfrage: "(objectClass -eq "contact") -and (Path
"OU=Consulting,OU=Kontakte,DC=cvn,DC=local")" Fehlermeldung: "syntax error" an folgender Position: "40".
In Zeile:8 Zeichen:13
+ $contacts = Get-ADObject -Filter {(objectClass -eq "contact") -and (P ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Get-ADObject], ADFilterParsingException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADFilterParsingException,Micr
osoft.ActiveDirectory.Management.Commands.GetADObject.
Danke schonmal für die Hilfe!