Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Valued Contributor II

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

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:\ ?