Best Practice: Remote Commands

Is there a best practice for running cmdlets against a remote computer?

For example:

Get-NetAdapter -CimSession $Session ...
Invoke-Command -ComputerName $Session -Scriptblock { Get-NetAdapter }

Is either of these “better” than the other, or does it come down to personal preference?


Those use slightly different protocols. Aside from that, the former doesn’t work in Core, I don’t think.

Core has new-cimsession (windows only). Core doesn’t have get-netadapter.

Thanks. Going to rework a few modules to use only the ICM then.