I created a perl script for adding users to Active Directory a few months ago. On Windows 7 it runs fine. On Windows 10 perl is not able to run "dsquery" or "dsadd" but I can really not understand this.
When I run "dsquery" from the same command line, it works. Trying with the perl script... It won't!
Der Befehl "C:\Windows\System32\dsquery.exe" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
(= Command dsquery could not be found...)
Some code snippets from the perl script:
$datetime = strftime("%d.%m.%Y %H:%M:%S", localtime);
&GetOptions ("-v=s" => \$fname,
"-n=s" => \$sname,
"-u=s" => \$uname,
"-p=s" => \$pwd,
"-noshare" =>\$noshare,
"-test" =>\$test,
"-noquota" =>\$noquota,
"-sshpw=s" =>\$sshpw );
unless ($fname) {
print "Vorname: ";
$fname = <STDIN>;
chomp $fname;}
unless ($sname) {
print "Nachname: ";
$sname = <STDIN>;
chomp $sname;}
unless ($uname) {
$uname = substr($fname, 0, 1);
$uname = "$uname.$sname";}
$uname = lc($uname);
if (`C:\\Windows\\System32\\dsquery.exe user -samid $uname`){
print "Benutzer $uname existiert bereits!";
exit;}
At this point it already stops. But, when I run:
c:\windows\system32\dsquery.exe user -samid ANYUSER
it works.
What is happening right here? Can anyone undestand this??
Cheers, Lukas