PowerShell 3+
Did you know that you can easily export modules from other computers to your local machine? Assume you don’t have the RSAT tools but would like to use their cmdlets to administer Active Directory, or you’d like to use the ServerManager module to manage a server.
Here are the simple steps that it takes to export a module from a remote system to your local machine:
$server = 'server123' $moduleToExport = 'ServerManager' $localModuleName = 'myServerManager' # connect to remote machine $session = New-PSSession -ComputerName $server # export a module from there to your local machine Export-PSSession -Session $session -Module $moduleToExport -OutputModule $localModuleName # get rid of the session Remove-PSSession -Session $session # find new module Get-Module -Name $localModuleName -ListAvailable
Of course, this approach uses a trick. The module that you export will still live on the remote system. Export-PSSession simply creates a proxy module that forwards your commands to the remote system. This is why your client computer needs no special module-related requirements. All you need is a remote connection. If the remote connection is not found, the module auto-creates it for you.