Hello.
Can anyone help me how to convert the script to work in Powershell 2.0?
Ex.
UserParameter=custom.vfs.dev.discovery,powershell -NoProfile -ExecutionPolicy Bypass -Command "& {[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $result_json = @{'data' = @(Get-WmiObject win32_PerfFormattedData_PerfDisk_PhysicalDisk | Where-Object {$_.name -ne '_Total'} | ForEach-Object {@{ '{#DEVICENAME}' = $_.Name }})} | ConvertTo-Json; [Console]::WriteLine($result_json);}"
Problem is with ConvertTo-Json:
The term 'ConvertTo-Json' is not recognized as the name of a cmdlet
In this Host I can't update powershell to higher version. But I need to get some information from it.
Can anyone help me how to convert the script to work in Powershell 2.0?
Ex.
UserParameter=custom.vfs.dev.discovery,powershell -NoProfile -ExecutionPolicy Bypass -Command "& {[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $result_json = @{'data' = @(Get-WmiObject win32_PerfFormattedData_PerfDisk_PhysicalDisk | Where-Object {$_.name -ne '_Total'} | ForEach-Object {@{ '{#DEVICENAME}' = $_.Name }})} | ConvertTo-Json; [Console]::WriteLine($result_json);}"
Problem is with ConvertTo-Json:
The term 'ConvertTo-Json' is not recognized as the name of a cmdlet
In this Host I can't update powershell to higher version. But I need to get some information from it.
Comment