Q. How can I run a PowerShell cmdlet against a remote computer?

A. If the cmdlet has a -computerName parameter, then just use that. Otherwise, you'll need to use remoting, which must be enabled on the remote computer by running

  1. Enable-PSRemoting

on it. (PowerShell 2.0 must be installed on your computer and the remote computer.) Then, run

  1. Invoke-Command -scriptblock { #whatever } -computername remote-computer

on your computer. Substitute your desired cmdlet for #whatever and insert the proper computer name in place of remote-computer. You only have to enable remoting once. After doing so, you can invoke commands on the remote-enabled computer whenever you like. You'll usually need to have PowerShell running as Administrator, or you'll have to add the -credential parameter to Invoke-Command and specify Administrator credentials for the remote machine.

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