Generate user-packages.xml from command line

Simple question - can I create the ‘user-packages.xml’ file from the command line or in a bash script without running YaST/Software Management?