mkellerman / Invoke-CommandAs

Invoke Command As System/Interactive/GMSA/User on Local/Remote machine & returns PSObjects.

Home Page:https://www.powershellgallery.com/packages/Invoke-CommandAs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nothing happens

Gobiman opened this issue · comments

Nothing happens when I run the command, see below the $error
Powershell version is 5.1

Get-Job : The command cannot find the job because the job name bc725259-2000-4917-8639-276a36418032 was not found.
Verify the value of the Name parameter, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\2.0\Invoke-CommandAs.psm1:208 char:36

  • ... -Not($Job = Get-Job -Name $ScheduledJob.Name -ErrorAction SilentlyCon ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (bc725259-2000-4917-8639-276a36418032:String) [Get-Job], PSArgumentExcep
      tion
    • FullyQualifiedErrorId : JobWithSpecifiedNameNotFound,Microsoft.PowerShell.Commands.GetJobCommand

Can you provide more info:

-OS
-PSVersion
-example of code to reproduce the error
-command line use and parameters

Hi
OS= Win2016 (works locally but not remotely), running as admin on both systems
PSVersion= 5.1.14393.2363
Invoke-CommandAs -ComputerName 'ServerName' -ScriptBlock { Get-Process }
The output
PS C:\local> $Error
Get-Job : The command cannot find the job because the job name 47621e7f-6d1f-4265-b011-05eb16fe8705 was not found.
Verify the value of the Name parameter, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\2.0\Invoke-CommandAs.psm1:208 char:36

  • ... -Not($Job = Get-Job -Name $ScheduledJob.Name -ErrorAction SilentlyCon ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (47621e7f-6d1f-4265-b011-05eb16fe8705:String) [Get-Job], PSArgumentExcep
      tion
    • FullyQualifiedErrorId : JobWithSpecifiedNameNotFound,Microsoft.PowerShell.Commands.GetJobCommand

Get-Job : The command cannot find the job because the job name 47621e7f-6d1f-4265-b011-05eb16fe8705 was not found.
Verify the value of the Name parameter, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\Invoke-CommandAs\2.0\Invoke-CommandAs.psm1:208 char:36

  • ... -Not($Job = Get-Job -Name $ScheduledJob.Name -ErrorAction SilentlyCon ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (47621e7f-6d1f-4265-b011-05eb16fe8705:String) [Get-Job], PSArgumentExcep
      tion
    • FullyQualifiedErrorId : JobWithSpecifiedNameNotFound,Microsoft.PowerShell.Commands.GetJobCommand

Thanks

Please provide a -Credential when executing against a remote machine.

Did this resolve your issue?

Also, try establishing a New-PSSession, and use that instead of ComputerName/Credential. Just to help debug.

Will close this issue until further notice.

I fixed some issues in latest release (3.0), maybe worth retesting!