The Provisional Government told the allies it was willing to continue and stay in the war; this was good news for the allies but bad for the provisional government.
The Bolsheviks were helped when Kornilov was marching on Petrograd, Kerenski the leader of the provisional government was scared that the Kornilov would take the opportunity to make a coup, and make Russia into a military dictatorship, and he was scared that he would lose his government position.
Kerenski responded to this threat by distributing weapons between the Soviets who promised to help and defend him, he took this promise seriously and gave the Bolsheviks the weapons, the Bolsheviks created the Red Guard which kept and controlled the weapons.
Kornilov´s army was starting to desert and this leaving him with no troops and with only fleeing as an option.
Kerenski now faced an even bigger problem the Red Guards who held a vast arsenal of his weapons, the problem that he had basically signed his death warrant. Kerenski was now in a very delicate situation.
One night the Red Guards took over many strategic points over Petrograd. The next morning Kerenski woke up with most of Petrograd occupied by the Red Guards.
The Red Guards stormed the Winter Palace; this is where the Provisional Government worked.
When all this was done the Bolsheviks started their consolidation of power by eliminating or exiling their direct enemies, Lenin was sent back from Switzerland where he was exiled.
Lenin started by moralising and giving reason to the people, he then stared declaring his ideological ideas about communism and how it was supposed to work, he promises the people “bread peace and land”, the people believe him and begin to trust Lenin, he writes everything above in the April Thesis where he explains all the above.
Lenin to get to power took a very big risk in say that the power should be given to the soviets, when he said this the Bolshevik party didn’t even have a majority in any Soviet. He then came slowly to power, and only in September 1917 did the Bolsheviks have a majority in the soviets. Lenin to make clear that Russia wouldn’t return to the war agreed to the terms of the treaty of Brest-Litovsk.
Lenin had at his disposal nearly all the crowns assets, he used these assets to create his image as a leader, serious, disciplined person.
All this wasn’t enough for Lenin and the Bolsheviks to be happy, because they had gathered many enemies on there climb to power.
Lenin in 1917 in one of his speeches