Author Posts

February 13, 2018 at 2:14 pm

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?

Thanks,
Des

February 13, 2018 at 5:33 pm

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

February 13, 2018 at 6:58 pm

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

February 13, 2018 at 9:40 pm

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