I have 2 basic powershell test scripts (test1.ps1 and test2.ps1)
Test1.ps1 looks like this:
$mytime =Get-DateWrite-Host"Passing in: $mytime" $myvar =Invoke-Expression"C:\temp\Test2.ps1 -reftime $mytime"
Test2.ps1 looks like this:
param([datetime]$reftime)Write-Host"Received: $reftime"
When I run Test1.ps1, I receive the messages in the console pane:
Passing in: 06/17/2013 01:32:02
Received: 06/17/2013 00:00:00
Does anyone know why the time is changed to 00:00:00?
Thanks for any help.