Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Start-Job fails with "The directory name is invalid"

$
0
0

When executing a PowerShell script which uses Start-Job, the invocation of Start-Job fails when the script is executed directly from explorer through an lnk.

If I open a cmd or powershell session, then invoke the same lnk file. The Start-Job executes as expected.

Example PS:

  Start-Job -Credential (Get-Credential) -ScriptBlock {"Test";whoami}
  Get-Job | Wait-Job | Receive-Job
  Start-Sleep -Seconds 9999

Full execution process is .\Administrator -> double click .lnk -> cmd on NetShare -> PS on same NetShare as shown above.

Changing the execution process to .\Administrator -> cmd -> .lnk -> cmd on NetShare -> PS on same NetShare as shown above, resolves the issue.

This seems similar to the following post: http://www.alexwinner.com/articles/powershell/62-startjob-error-directory-name-invalid.html. I am having a domain user login to execute a process. I did set the Start In path of the lnk to c:\ just in case, the issue persists.

Honestly this seems relative to Start-Job not having the ability to perform second hop authentication when started from an lnk. As we are using redirected Desktops to a network share.


Viewing all articles
Browse latest Browse all 6937

Trending Articles