For the brevity of this post, I will only download couple of R packages from CRAN repository, but this list is indefinite.
There are ways many ways to retrieve the CRAN packages for particular R version using powershell. I will just demonstrate this by using Invoke-WebRequest cmdlet.
Pointing your cmdlet to URL: https://cran.r-project.org/bin/windows/contrib/3.5 where list of all packages for this version is available. But first we need to extract the HTML tag where information is stored.
There’s quite a bit of code here, but the upside is that you get the ability to automate server installs.