Open Rtw915 opened 4 years ago
I think it is a bug
I have a script that run fine in ISE or the console but would not run in PRTG.
in PRTG it would output this in the log file:
(1) : using System; At C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.4.4\PoshRSJob.psm1:51 char:5 + Add-Type @" + ~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerErro r) [Add-Type], Exception + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand WARNING: (0) : No source files specified (1) : using System; Add-Type : Cannot add type. Compilation errors occurred. At C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.4.4\PoshRSJob.psm1:51 char:5 + Add-Type @" + ~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException + FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand Unable to find type [RSJob]. At C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.4.4\Public\Get-RSJob.ps1:72 char:9 + [RSJob[]]$Job, + ~~~~~~~~~ + CategoryInfo : InvalidOperation: (RSJob:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound Unable to find type [RSJob]. At C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.4.4\Public\Get-RSJob.ps1:72 char:9 + [RSJob[]]$Job, + ~~~~~~~~~ + CategoryInfo : InvalidOperation: (RSJob:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound
After searching for the issue I found this: https://social.technet.microsoft.com/Forums/windows/en-US/c8467128-ab64-4920-8697-3cc76e901568/addtype-usage?forum=winserverpowershell
In PoshRSJob.psm1 I changed line 72 from:
public DateTime LastActivity = DateTime.MinValue; to public System.DateTime LastActivity = System.DateTime.MinValue;
public DateTime LastActivity = DateTime.MinValue;
public System.DateTime LastActivity = System.DateTime.MinValue;
It now appears to work.
I think it is a bug
I have a script that run fine in ISE or the console but would not run in PRTG.
in PRTG it would output this in the log file:
After searching for the issue I found this: https://social.technet.microsoft.com/Forums/windows/en-US/c8467128-ab64-4920-8697-3cc76e901568/addtype-usage?forum=winserverpowershell
In PoshRSJob.psm1 I changed line 72 from:
public DateTime LastActivity = DateTime.MinValue;
topublic System.DateTime LastActivity = System.DateTime.MinValue;
It now appears to work.