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

How to get output of console application in PowerShell Job?

$
0
0

I have simple My.DLL with code:

    public class Class1
    {
        public static void WriteInConsole()
        {
            Console.WriteLine("LINE FROM DLL");
        }
    }

So, I open PS and type:

   Import-Module 'C:\My.dll'

   [My.Class1]::WriteInConsole()

Then I see output line.

   LINE FROM DLL

Then I try to get this message in job. I type:

   Start-Job -Name dllJob -ScriptBlock { Import-Module 'C:\My.dll'; [My.Class1]::WriteInConsole() }

   receive-job -Name dllJob

I don't see message.

QUESTION:

                What is wrong?

                How to get output of console application in PowerShell Job?

Thank you!


Viewing all articles
Browse latest Browse all 6937

Trending Articles