Created
September 7, 2018 03:17
-
-
Save mrdaemon/6809290212dd6d8357ee258ef3534f43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q:\> Test-Connection -Count 5 -delay 2 -ComputerName hexagram | |
Source Destination IPV4Address IPV6Address Bytes Time(ms) | |
------ ----------- ----------- ----------- ----- -------- | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
# Delay occured, as expected | |
Q:\> Test-Connection -Count 5 -delay 2 -ComputerName hexagram -AsJob | |
Id Name PSJobTypeName State HasMoreData Location Command | |
-- ---- ------------- ----- ----------- -------- ------- | |
7 Job7 WmiJob Running True . Test-Connection | |
# Immediately returns? the WmiJob just kind of completes and seems to not do the delay | |
Q:\> get-job | |
Id Name PSJobTypeName State HasMoreData Location Command | |
-- ---- ------------- ----- ----------- -------- ------- | |
5 Job5 BackgroundJob Completed False localhost Test-Connection -Dela... | |
7 Job7 WmiJob Completed True . Test-Connection | |
# It's all there, just like, without the delay. | |
Q:\> receive-job 7 | |
Source Destination IPV4Address IPV6Address Bytes Time(ms) | |
------ ----------- ----------- ----------- ----- -------- | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
# This however makes a BackgroundJob instead of a WmiJob and works as you'd expect | |
Q:\> Start-Job -ScriptBlock { Test-Connection -Count 5 -Delay 2 -ComputerName hexagram } | |
Id Name PSJobTypeName State HasMoreData Location Command | |
-- ---- ------------- ----- ----------- -------- ------- | |
9 Job9 BackgroundJob Running True localhost Test-Connection -Coun... | |
# Still running | |
Q:\> get-job | |
Id Name PSJobTypeName State HasMoreData Location Command | |
-- ---- ------------- ----- ----------- -------- ------- | |
9 Job9 BackgroundJob Running True localhost Test-Connection -Coun... | |
# Ok it's done now, after the appropriate, expected delay | |
Q:\> get-job | |
Id Name PSJobTypeName State HasMoreData Location Command | |
-- ---- ------------- ----- ----------- -------- ------- | |
9 Job9 BackgroundJob Completed True localhost Test-Connection -Coun... | |
Q:\> Receive-Job 9 | |
Source Destination IPV4Address IPV6Address Bytes Time(ms) | |
------ ----------- ----------- ----------- ----- -------- | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
PIXEL hexagram 172.16.64.28 32 0 | |
Q:\> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment