Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell RedirectStandardOutput

Posted on 2013-10-31
5
Medium Priority
?
351 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 41

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 41

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

Lessons on Wi-Fi & Recommendations on KRACK

Simplicity and security can be a difficult  balance for any business to tackle. Join us on December 6th for a look at your company's biggest security gap. We will also address the most recent attack, "KRACK" and provide recommendations on how to secure your Wi-Fi network today!

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

877 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