Solved

Powershell RedirectStandardOutput

Posted on 2013-10-31
5
314 Views
Last Modified: 2013-11-06
Hi,

I've got a Powershell script that's been running great for over a year. We just upgraded the application that the script interfaces with as well as made some application-related server updates and all of a sudden I'm not getting any log output from the below command:

Start-Process bulkimport.bat -Wait -PassThru -RedirectStandardOutput $LogPath `
            -ArgumentList "-user $Username -password $Password -dir $StagingDirInQuotes"

The file at $LogPath is just a zero byte file now. I tried removing "-RedirectStandardOutput $LogPath" and also see no output at the command line. I'm pretty sure the Powershell version has been not been updated. $PSVersionTable.psversion reveals:

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1      

Any ideas what may be going on? I'd really appreciate your help.

Thanks very much.
0
Comment
Question by:DarthElmo
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:footech
ID: 39615176
Does the bulkimport.bat file run and output correctly when run either a PS console or cmd console?
0
 

Author Comment

by:DarthElmo
ID: 39615219
Yes, the bat file does run in a PS console and complete successfully. The log data is then very important to parse through after the bat file completes.

Thank you
0
 

Accepted Solution

by:
DarthElmo earned 0 total points
ID: 39616848
After further testing, I'm finding that if there's a failure with bulkimport.bat, just the error and nothing else is output. So it seems like the default debug level in the application may have changed from DEBUG or INFO to ERROR. Since no one here has access to the application, I'm cancelling this question. Footech, thank you for your time.
0
 
LVL 39

Expert Comment

by:footech
ID: 39616894
Not a problem.  Sorry I couldn't be of more help.  You might try some redirection to std output to see if that works for you, like "2>&1".
0
 

Author Closing Comment

by:DarthElmo
ID: 39626785
I now see that my question almost certainly cannot be answered without access to the application files.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now