To help you better we need some information from you.
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: powershell studio 2021
Operating system: windows 10
PowerShell version(s): 5.1
32-bit version of software? no
I'm trying to convert existing working code into powershell studio.
$ComputerName = $InputBox2.text;
$psx =Join-Path $PSToolsPath Psexec64.exe
$results = & $psx -accepteula -nobanner \\$ComputerName netstat -an
foreach($r in $results)
{
$outputBox.Appendtext(("$r") + ("`r`n"))
}
problem is that when i run this in powershell studio the command opens a cmd window runs the netsta -an but the output is not in the $results variable so i cannot send it to the $outputBox. This works in my original script. I suspect its because a cmd window is opening and the output is lost somewhere. Any Ideas how i can capture the result ?
DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
capture cmd output and display in textbox
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: 1
- Last visit: Sun Jun 20, 2021 10:38 am
Re: capture cmd output and display in textbox
[Topic moved by moderator to PowerShell GUIs forum]
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: capture cmd output and display in textbox
Looks like you are missing the Out-String
This might help:
https://jackgruber.github.io/2018-05-11 ... ss-output/
This might help:
https://jackgruber.github.io/2018-05-11 ... ss-output/
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.