Hi everyone here,
I'm currently developing a tools with PowerShell. I would like to let this tools run in PowerShell x64. But some of my action need to call a CmdLet in a DLL, but this dll does not has x64 version. I have to use PowerShell x86 to get this done and get the result. Something like this:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -command "& { Import $dll; Do-Someting }"
However, this method to call a dll returns result as string. How can I let it return the original object from CmdLet Do-Someting?
Thanks in advance!
How to let PowerShell x86 return an object while call powershell x86 cmdlet from powershell x64
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 15
- Last visit: Wed Jan 19, 2022 4:49 pm
Re: How to let PowerShell x86 return an object while call powershell x86 cmdlet from powershell x64
You cannot return objects from external programs. You can only return strings. YOU could output XML and turn that into an object.
Get-Service spooler | convertto-xml
Get-Service spooler | convertto-xml