Do not get PowerShell results

I am experimenting with tasks in PowerShell, but I canโ€™t get the results. Here is some conclusion from the shell.

Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Users\Administrator> dir Directory: C:\Users\Administrator Mode LastWriteTime Length Name ---- ------------- ------ ---- dr-- 6/18/2013 11:52 AM Contacts dr-- 6/20/2013 1:00 PM Desktop dr-- 6/18/2013 11:52 AM Documents dr-- 6/18/2013 11:52 AM Downloads dr-- 6/18/2013 11:52 AM Favorites dr-- 6/18/2013 11:52 AM Links dr-- 6/18/2013 11:52 AM Music dr-- 6/18/2013 11:52 AM Pictures dr-- 6/18/2013 11:52 AM Saved Games dr-- 6/18/2013 11:52 AM Searches dr-- 6/18/2013 11:52 AM Videos -a--- 6/20/2013 12:57 PM 13404 services.html PS C:\Users\Administrator> Start-Job -ScriptBlock { dir } Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 Job1 Running True localhost dir PS C:\Users\Administrator> get-job Id Name State HasMoreData Location Command -- ---- ----- ----------- -------- ------- 1 Job1 Completed False localhost dir PS C:\Users\Administrator> Receive-Job -id 1 PS C:\Users\Administrator> 

The above result is from the Win2008 R2 server that I created and updated to the domain controller. This is the only computer in the domain and is not connected to other computers.

I have no problem getting results when I run these commands on other computers. What can make this work not produce products? Where should I look for this problem? I looked through the event logs and did not find any problems.

Edit: Thanks to everyone for your help, but I'm going to consider this. I believe that something was damaged during the build of the server or the installation of the patch, since no other computer showed any behavior. Since then I have been transferring data and rebuilding the server, and it worked perfectly.

+4
source share
2 answers

Start-Job does not start jobs in the current directory. It starts a new PowerShell process and uses a different directory for this work. As follows from another answer, its possible this directory is empty on your server, so nothing is returned. What happens if you just write some output in your Start-Job script block? Do you get any result?

 Start-Job { Write-Host "In ur job." ; Get-Location ; dir } | Wait-Job | Receive-Jo 
+1
source

Source: https://habr.com/ru/post/1489804/


All Articles