I was recently trying to debug some issues that I was having with the people picker that is shown when creating audiences and I found that I needed a way to manually trigger the distribution list import quickly but I didn't always want to have to wait for the user profile import to finish. If you run an import using the SSP admin site you might notice that it imports all the user profile information and then it imports the distribution list information but there's no way (at least that I could find) to do just the distribution list. So I created a new command which I called gl-runprofileimportjob which allows me to run the profile import.
Fortunately it turned out that the code to do this is really simple - you just need an instance of the UserProfileConfigManager and you call either StartImport() or StartDLImport(). To keep the command from exiting before the import is complete I check the IsImportInProgress method and loop until it is set to false:
The syntax of the command can be seen below:
C:\>stsadm -help gl-runprofileimportjob stsadm -o gl-runprofileimportjob Executes a Profile Import. Parameters: -sspname <SSP Name> [-distributionlistonly] [-incremental]
Here's an example of how to run the command to import just the distribution lists:
stsadm -o gl-runprofileimportjob -sspname SSP1 -distributionlistonly
Note that the "-incremental" flag is only relevant when the "-distributionlistonly" flag is not provided.