These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Is it possible to delete all domains through Virtualmin CLI on the new forum.
I wonder is it possible to delete all domains using the command this command: https://www.virtualmin.com/documentation/developer/cli/delete_domain
Trying
virtualmin delete-domain *
or
virtualmin delete-domain all
didn't work.
I know it is not safe and probably this never will be used, but need this to figure out for scripting purposes.
Edit: I hope Virtualmin developers will elaborate on this, but just in case if there is no oneliner command then a script can be written to find our all the users (they are listed in /home/) and feed them one by one to this command:
virtualmin delete-domain --user username-here
Howdy,
The delete-domain parameter only accepts one domain.
However, you could run
virtualmin list-domains --name-only
, and then pass that output intovirtualmin delete-domain --domain
.Your suggestion would work as well.
One (untested) example of how to run the above as a one-liner would be:
virtualmin list-domains --name-only | xargs virtualmin delete-domain --domain
The above should delete all domains from the server.
-Eric
Thanks Eric for the giving right direction. The one-liner that works is:
virtualmin list-domains --name-only | xargs -I{} virtualmin delete-domain --domain {}