Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Scripting >> Perl >> ADSI >> How to use windows server resource kit utility query.vbs with Perl to gather user information

Assumptions =========== - that queryad.vbs is in a directory which is in system PATH, otherwise, replace the queryad.vbs below with <fullpath>\queryad.vbs where fullpath is the full path of the directory where queryad.vbs is located. Perl script =========== use File::Basename; if($#ARGV < 0) { die "\nUsage:\n\n\ $prog displayname \n"; } $displayName = $ARGV[0]; %user = GetADInfo($displayName); print $user{"displayName"}; sub GetADInfo { my %userobj; my $displayName = shift; if ($displayName ne "") { open(CMD,"cscript queryad.vbs -u \"$displayName\" | "); while(<CMD>) { if ( /^(\w )[:](.*)$/gi ) { $par = ; $val = ; $par =~ s/^ //gi; $par =~ s/ $//gi; $val =~ s/^ //gi; $val =~ s/ $//gi; $userobj{$par} = $val; } } close(CMD); } else { print "displayName cannot be BLANK\n"; } return %userobj; }
[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]