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.
June 10, 2010
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.
About the Author
You May Also Like