Installing Powershell modules through GPO
I've found one module really instresting, and want to use it on whole AD domain. Is there any way, to automatize this process? In normal Powershell, I have to simply call this command, with admin privileges:
Install-Module -Name $moduleName
And if it's untrusted repository, then I have to change it:
Set-PSRepository -name $repoName -InstallationPolicy trusted
I'm looking for more elegant way, than runing these commands on computer startup, as simple PS script.
The ideal solution would look like this:
- Something checks, if computer has installed modules on it.
- If it doesn't, then modules are installed, and computer is from now recognised as machine with modules installed.
- If it does have modules installed, then no actions are taken.
Or even better:
- There is some sort of container, that contains computers without installed modules.
- Modules are installed on every computer in this container, and then moved outside of it.
The second one could work on simple domain containers, where we got subcontainer with GPO, that runs PS script with commands from above. We can move computers through this structure, by using PS Active Directory cmdlets. And I see next problem, would automatic moving from container to another container, be safe on a bigger scale and in longer period of time?
You have to make a to steps job.
1)Create an msi that install your module, simple way is explain here
2)Use a GPO to install the MSI to all machines, as explain here