Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to gather output to a text file or a variable running psexec from vbscript?

I've written a function which obtains UNC path from entered DFS path from remote computer by running dfsutil within psexec (dfsutil diag viewdfspath).
But the problem is, the output gets displayed on a command prompt on my computer which I am unable to export (pipe) to any file or a variable.
Below is the function which I have written:
-------------------------------------------------------------------------
Function actiongetuncpath(remoteComputer)
Dim retVal: retVal = False
Set objShell = CreateObject("WScript.Shell")
Command = "psexec -s \\" & remotecomputer & " dfsutil diag viewdfspath " & dfspath
objShell.Run Command

Log " !! Successfully executed get UNC path command on " & UCase (remotecomputer) , True, "dfspath", 1

actiongetuncpath = retVal
End Function

'dfspath - variable that stores entered DFS path
------------------------------------------------------------------------
I have tried Command = "psexec -s \\" & remotecomputer & " dfsutil diag viewdfspath " & dfspath & ">C:\output.log"

but it does not work giving error 87 in dfsutil.
Using the same command locally will work but not remotely.

Could anyone help me on this?
I need to either export the output obtained in a txt / log file or to any variable which I can pipe to output screen.

1 Reply
fosuzuki
Partner - Specialist III
Partner - Specialist III

Maybe you have to enclose the dfspath in double qoutes? How do I resolve an access denied error in DFS when trying to show root?

Or maybe the user doesn't have permission to write in C:\ ?