Q. How can I use a PowerShell cmdlet that's in a module on another computer?

You can use a PowerShell cmdlet that's in a module on another computer by using a feature called implicit remoting. Start by establishing a remoting session to the computer that contains the module you want.

Don Jones

June 10, 2010

1 Min Read
Laptop screen showing a laptop showing a laptop with birds

Q. How can I use a PowerShell cmdlet that's in a module on another computer?

A. You can use a PowerShell cmdlet that's in a module on another computer by using a feature called implicit remoting. Start by establishing a remoting session to the computer that contains the module you want, using a command such as

 $session = New-PSSession -computerName whatever

 substituting whatever with your computer's name. Then tell that session to import the module that you want to use, with a command such as

 Invoke-Command -scriptblock { Import-Module ActiveDirectory } -session $session

substituting your module's name for ActiveDirectory. Finally, import those commands into your local shell

Import-PSSession -module ActiveDirectory -session $session

again providing the proper module name in place of ActiveDirectory. Those commands will remain available in your local shell for as long as the session remains open. There are some minor differences in using some commands this way, but most commands will run transparently more or less.

Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.

 

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like