Scripting connecting to source control

Hi, I’m very new to UE but I’m needing to bring it into our animation pipeline.

I want to automate the process of connecting to Perforce. That is, instead of the user clicking the Source Control tool button, setting the provider to Perforce, editing the settings and hitting Accept, I want to do all this from a script. Is there a way in to do this stuff?

Thanks in advance,