The pirates that appear in space are found in GalacticEventDefs.xml. Since you have all DLC, use the one located in C:\Program Files (x86)\Steam\steamapps\common\Galactic Civilizations III\DLC\EXP2_Crusade\Game. The event you want is the second one in the file. The Internal Name is SpawnPirates.
Some of the mega events are in C:\Program Files (x86)\Steam\steamapps\common\Galactic Civilizations III\data\Game. Each one has a separate file, such as PirateColony_MegaEventDefs.xml. The Internal Name is in each one.
The mega events from the Mega Events DLC are located in C:\Program Files (x86)\Steam\steamapps\common\Galactic Civilizations III\DLC\DLC2_MegaEvents\Game. Each one has a separate file, such as Assassination_MegaEventDefs.xml. The Internal Name is in each one.
To spawn an event, open the console and type in event InternalName and hit enter.
You must use the InternalName exactly as it is in the file. For example, to spawn the pirates that appear in space, enter the command event SpawnPirates to get them to appear.
Some will happen immediately, and others will happen at the beginning of the next turn.