Created
April 24, 2018 09:59
-
-
Save shaneis/54cd93edb558cc7204dbeb9ca14a1fe7 to your computer and use it in GitHub Desktop.
First attempt at scriptblock
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
[Scriptblock]$Script = { | |
if ((Get-Date).Second -lt 15) { | |
'1st Quarter' | |
} | |
elseif ((Get-Date).Second -lt 30) { | |
'2nd Quarter' | |
} | |
elseif ((Get-Date).Second -lt 45) { | |
'3rd Quarter' | |
} | |
else { | |
'4th Quarter' | |
} | |
} | |
for ($i = 0; $i -lt 10; $i++) { | |
[PSCustomObject]@{ | |
Date = Get-Date | |
ScriptBlock = 'Actual Scriptblock' | |
DateDescription = Invoke-Command -Script $Script | |
} | |
Start-Sleep -Seconds 6 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment