Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 26th, 2014, 07: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
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 12:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.