runtime error - Cannot find an overload for op_subtraction when subtracting datetime from datetime in powershell -
I can not get a surcharge for the error of The defective line is: (changed below for help with debugging) Full code: It's amazing that it works fine on my machine, but on the errors of a colleague, so I'm guessing this about my environment ... Upgrading PowerShell 3.0 to PowerShell 2.0 solved the problem. In the comments, as commented by @ CB, it appears PowerShell 3.0 includes Windows Management Framework 3.0. Download: op_subtraction error while running the code given below, Reporting that the second argument is invalid. if ($ - now - (non-job- $ $ job id.) PSBeginTime -gt [Timespain] :: From Minutes ($ KillTaskTimeMins) { if (($ $ - $ when) -gt [Timespain]: : Minutes ($ killTaskTimeMins))
$ ($ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ throttle jobs are moving at any one time (@ (Get-jobs | object-object {$ _. state -akyu 'Running'}). Count-gate $ throttle) {start-Sleep- Millisecun $ $ Throttle Sleep MMS # Matter any work speculation, kill after X minutes = now $ = matching-date forwarding ($ job-in @ (Get-Job -State Running)) {# $ when = Coalesce (Get- Job -Id $ job.id) .PSBeginTime, $ now) is a custom task to make sure that it is not zero; but the writeer did not help to host, but it was not empty, however $$ = (Get-Job-$ job.id) was removed. PSBeginTime Writing-Host "Now:" + $$ # A valid date time Kna-host guess "when" + $ # when a valid date time (if $ - $ then) -gt [Taimspen] :: Seminiten ($ killTaskTimeMins)) {# & lt; - - Error order stop here - Job $ job}} Open-work-filepath GetIEVersion.ps1 -Next column $ computer # We call a custom script to get some data} # To iterate through the results of the work More stuff here; Output to CSV job. PSBeginTime can be from the data type Nullable & lt; DateTime & gt; to DateTime .
Comments
Post a Comment