That's weird that it works when pasted to the powershell console, but not in
the script, is it a bug? Anyway, the reason I added that, is because a blank
line gets displayed before the time spans the first time the script runs
(another bug?)
"Kiron" <Kiron@xxxxxx> wrote in message
news

658F33C-F949-49BB-8D49-43C9FF8B4681@xxxxxx
> The problem is an outstream quirk that starts in this line:
>
> $NextYearDate - ([datetime]::now)
>
> When the output -in the form of a Format-List- is merged with
> Format-Table's output, the script breaks.
> To fix it pipe the output from that lne to Out-Default.
>
> # pipe the output to Out-Default
> $NextYearDate - ([datetime]::now) | Out-Default
>
> # or suppress it, since it's wiped by the cls statement anyway
> $NextYearDate - ([datetime]::now) | Out-Null
>
> --
> Kiron