Hello all
After searching I can't find anything that covers this issue.
I am trying to put together an app for our service desk to use to unlock files on our NAS. I'm trying to use 'openfiles /Query /S <server> /FO CSV' to pull the list of open files from the NAS. This code works by itself when run in the console but when triggered as a button press on a form nothing is returned in the console. I call dfsutil on a different button press which works without issue. Openfiles runs by itself and will give an access denied error as openfiles requires local admin to run. It appears as though the command completes but just returns nothing where it should be returning a reasonable amount of information.
$cmd = 'openfiles'
$arg1 = '/Query'
$arg2 = '/S'
$arg3 = '<server>'
$arg4 = '/FO'
$arg5 = 'CSV'
& $cmd $arg1 $arg2 $arg3 $arg4 $arg5
Powershell Studio 2016 64 bit, 5.2.129
Operating system:
Windows 7 64 bit OS:
CMD command not returning results in a Form
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
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 LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- simon.briggs
- Posts: 10
- Last visit: Mon Feb 01, 2021 6:18 am
- simon.briggs
- Posts: 10
- Last visit: Mon Feb 01, 2021 6:18 am
Re: CMD command not returning results in a Form
Found the answer by including a script file and calling it from the form.
Call-script_ps1 | Out-Default
The above returns the expected data.
Call-script_ps1 | Out-Default
The above returns the expected data.