Invoke-command -asJob Name

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 6 years, 5 months ago.

  • Author
  • #5234

    by iHunger at 2012-10-26 09:06:03

    Does Invoke-command -asJob have an easy way to set the job name, or is it easiest to do something like this:

    (invoke-command -ComputerName somepc -scriptblock {get-myinfo} -asJob).Name = "MyJobName123"

    by DonJ at 2012-10-26 09:12:22

    The -JobName parameter.

    by iHunger at 2012-10-26 11:10:07

    Perfect – Thanks Don. I don't know how many blog post I went through that talked about invoke-command and -asJob, but none of them bothered to name their jobs.

    *Ironically the first two things I tried were -asJob "MyJobName" and -Name "MyJobName".

    by DonJ at 2012-10-26 11:13:27

    LOL – I always have to remind myself to read the "-full" help for every new cmdlet I run across, so I'll have some idea of its other capabilities in the back of my head. And then do it again with every new version. I can't tell you how long it took me to discover -Delimiter on Export-CSV after v2 shipped.

You must be logged in to reply to this topic.