简体   繁体   中英

Differences in calling CSVDE from Powershell vs Command Prompt

Can anyone explain why calling the CSVDE utility from an elevated Windows command prompt would differ than using the same string from an elevated Powershell console? The issue I have is that I can successfully export from Active Directory via the command prompt method, but Powershell returns an authentication error, "Simple bind returned 'Invalid Credentials'.

Here is the command used for both, edited for sensitive pieces:

c:\csvde.exe -s domain.company.org -f ExportFile.csv -l "givenName,sn,ipPhone,title,department,company,physicalDeliveryOfficeName,mail" -d "OU=ABC Group,OU=ABC Users,DC=DomainName,DC=org" -a UserDistinguishedName Password

Both sessions are running with Administrator privileges. I am a Powershell novice, and for the life of me, I can't figure this out.

Thanks!

I can see two potential issues. First thought is that it is taking your user name and password as separate arguments, or as Adi Inbar suggested: you've got some special characters that are causing issues. Either way I'd enclose things in single quotes so that arguments are passed as expected, and taken literally.

c:\csvde.exe -s 'domain.company.org' -f 'ExportFile.csv' -l 'givenName,sn,ipPhone,title,department,company,physicalDeliveryOfficeName,mail' -d 'OU=ABC Group,OU=ABC Users,DC=DomainName,DC=org' -a 'UserDistinguishedName' 'Password'

See if that doesn't resolve the issue. In my experience that is usually a safe way to run a executable from PowerShell. I suppose alternatively you can assign them to variables, and then pass those.

$Server = 'domain.company.org'
$OutFile = 'ExportFile.csv'
$Attributes = 'givenName,sn,ipPhone,title,department,company,physicalDeliveryOfficeName,mail'
$SearchRoot = 'OU=ABC Group,OU=ABC Users,DC=DomainName,DC=org'
$UserID = 'CN=TMTech,OU=Users,DC=Some,DC=Company,DC=org'
$Password = 'P@$$w0rd'
CSVDE.exe -s $Server -f $OutFile -l $Attributes -d $SearchRoot -a $UserID $Password

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM