[Samba] rpcclient gather many users quickly

Dave Houser davehouser1 at gmail.com
Tue Aug 24 15:36:24 UTC 2021

I am using rpcclient with the command queryuser to gather information about
user password expirations.

Problem: rpcclient is slow when I have many users to gather (over 100), it
seems a new tcp connection needs to be established with authentication each
time rpcclient is run to gather info for all users.

My syntax is the following:

rpcclient -U $USER%$PASS -c "queryuser $i" $DC 2> ./rpc_errFile

$i = a list of users that I have.

I noticed that there is a different transport option I can use which is
"ncalrpc" but I don't understand how to use it in my command syntax, can
someone help with how I should use this?

More importantly is there a way I can pass a list of users via "queryuser"
command? or is it only one user at a time? Ideally I would like to send the
full list of users, have rpcclient authenticate once set up one tcp
connection and get all information back.

More information about the samba mailing list