Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
| Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 26th, 2014, 06:01 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dumping StoredProc output to text File ao7711 SQL Server DTS 8 January 12th, 2006 04:41 PM
Storing Value from Variable into Text File DaBigPolska Beginning VB 6 2 January 7th, 2005 05:34 PM
how to variable keep a value from text file? cslimcom C++ Programming 0 December 26th, 2004 10:13 PM
Print value of a variable to text file SubodhKumar SQL Language 2 December 10th, 2003 03:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.