Installing Origin and/or Steam games automatically in an unattended manner

Solution 1:

Steam

Valve provides CLI : https://developer.valvesoftware.com/wiki/SteamCMD

So it's possible to install games like this:

steamcmd +login anonymous +force_install_dir ../csgo_ds +app_update 740 +quit

Which logins to steam, creates custom folder and then installs CS:GO there.

This tool supports both Linux/MacOS and Windows, so you should be good automating your setup with it.

One limitation though, looks like it doesn't work for all the Steam games:

It works with games that use the SteamPipe content system.

Origin

I cannot find anything working right now, but in this answer author invested some time into Origin API.