Hi,
After Update to Version 4.X the old dosent work
Netxms config:
ExternalParameter = EXVersion:"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" "C:\Script\EXVersion.ps1"
Script: Get-Command Exsetup.exe | ForEach FileVersionInfo |fl Productversion
No Version Information.
After Searching i use this:
ExternalParameterShellExec = ExchangePatchNumber:pwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }
Value: forEach' is not recognized as an internal or external command
Debug log:
2022.05.20 13:11:46.415 *D* [exec ] RunExternal called for "ExchangePatchNumber" "Spwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }"
2022.05.20 13:11:46.415 *D* [exec ] RunExternal: command line is "pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }"
2022.05.20 13:11:46.423 *D* [procexec ] ProcessExecutor::execute(): process "CMD.EXE /C pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }" started
2022.05.20 13:11:46.467 *D* [procexec ] ProcessExecutor::readOutput(): stopped on GetOverlappedResult (The pipe has been ended.)
2022.05.20 13:11:46.467 *D* [comm.cs.1 ] GetMetricValue("ExchangePatchNumber"): 0 (SUCCESS) value = "'ForEach' is not recognized as an internal or external command,"
If I understand correctly then he leaves the variable $ ( 022.05.20 13:11:46.423 *D* [procexec ] ProcessExecutor::execute(): process "CMD.EXE /C pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }" started) out and that's why the error occurs?
In Powershell the Command works
Any ideas about it?
Thanks
After Update to Version 4.X the old dosent work
Netxms config:
ExternalParameter = EXVersion:"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" "C:\Script\EXVersion.ps1"
Script: Get-Command Exsetup.exe | ForEach FileVersionInfo |fl Productversion
No Version Information.
After Searching i use this:
ExternalParameterShellExec = ExchangePatchNumber:pwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }
Value: forEach' is not recognized as an internal or external command
Debug log:
2022.05.20 13:11:46.415 *D* [exec ] RunExternal called for "ExchangePatchNumber" "Spwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }"
2022.05.20 13:11:46.415 *D* [exec ] RunExternal: command line is "pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }"
2022.05.20 13:11:46.423 *D* [procexec ] ProcessExecutor::execute(): process "CMD.EXE /C pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }" started
2022.05.20 13:11:46.467 *D* [procexec ] ProcessExecutor::readOutput(): stopped on GetOverlappedResult (The pipe has been ended.)
2022.05.20 13:11:46.467 *D* [comm.cs.1 ] GetMetricValue("ExchangePatchNumber"): 0 (SUCCESS) value = "'ForEach' is not recognized as an internal or external command,"
If I understand correctly then he leaves the variable $ ( 022.05.20 13:11:46.423 *D* [procexec ] ProcessExecutor::execute(): process "CMD.EXE /C pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }" started) out and that's why the error occurs?
In Powershell the Command works
Any ideas about it?
Thanks