Skip navigation
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?

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.

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish