Hi all,
I have several scripts to do various tasks with IIS logs we receive from all our various web servers. One script unzips logs, another logparses to grab a few fields then sftp to a 3rd party for analysis, another will encrypt the original zip files in prep for ftp to 3rd party, another will ftp to that 3rd party, and yet another will analyse the logs with our in house analytiscs application.
I want to have a master script that will run these other scripts as jobs so that it will control when to start certain scripts based on the state of the jobs. It all seemed to work great as I was setting up test jobs, until I added '3rd' party executables like 7-zip, ftp.exe, winscp, etc... The jobs would just go to failed state when they hit the executables.
That's not my current problem though as I found out that if I used the -windowstyle hidden option for start-process then everything ran as expected, that is until I wanted to log output from the 3rd party app. FTP for example.
I tried this:
---------------
$ftpexe = "C:\windows\System32\ftp.exe"
$ftpscr="d:\scripts\ftpscrtmp.txt"
"open 111.1.1.1`r`nSomeFTPuser`r`nSomepassword <..bunch of other ftp commands>" | Out-File -FilePath $ftpscr -Append -Encoding "ASCII"
start-process -wait -filepath $ftpexe -argumentlist $ftparglist -RedirectStandardOutput $ftplog -windowstyle hidden
--------------
However, asking powershell to redirect output of a hidden window was probably like asking someone to cover their eyes and read a book and it let me know it.
I have tried without using -windowstyle hidden and not having any luck. I want to capture the output of the ftp commands so that I can make sure the file was transferred successfully. If I run the script without -windowstyle hidden and not as a job it works, and I can test the output. I really want to be able to run this script as a job AND get the output of the ftp to a file... advice?
Thanks in advance!