Installing powershell modules from powershell gallery on a machine with no direct internet access but which has access via a proxy just needs the proxy url / credentials supplied on the install-module command.
e.g. install-module vmware.vim -proxy http://<proxyip>:<proxy port>
However if you have no repositories registered with Powershell (such as the powershell gallery) you may still see errors relating to the NuGet provider:
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
And when attempting to install nuget, even specifying a proxy you may still get errors because the repository isn't registered.
The solution is to register the default repository via proxy, which will then allow modules to be installed
PS C:\> Get-PSRepository
WARNING: Unable to find module repositories.
PS C:\> Register-PSRepository -Default -Proxy http://<proxy ip>:<proxy port>
PS C:\> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
You should now be able to install modules via the proxy with the -proxy parameter