How to get Exchange Log File from using powershell? - exchange-server

I need a powershell command where I can find out where message tracking logs are written on exchange-enabled machines.
For example default Message Tracking log is here: %ExchangeInstallPath%TransportRoles\Logs\MessageTracking
And I want to powershell commands for this log path.
Thanks.

Related

.sh execution asking for "how you want to open this file" , not executing in cmd

I have downloaded kafka and trying to execute the start script using
.\bin\kafka-server-start.sh
.\config\server.properties
in cmd prompt, but the script is not executing ,instead windows is throwing "How do you want to open this .sh file".
The current default in "Set Assosiations" is "unknown application", not able to figure out why it is not executed.
Kafka has seperate batch files for windows environment in <kafka dir>/bin/windows directory. Use those to run on windows environment like this.
Use kafka-server-start.bat and kafka-server-stop.bat for kafka cluster.
You can find more details. https://github.com/apache/kafka/tree/trunk/bin/windows
There are Windows versions of all the scripts in the bin/windows directory, see https://github.com/apache/kafka/tree/trunk/bin/windows.
When running on Windows, use those instead of the normal shell scripts. This is mentioned literally in the first line of the Quick Start section in the docs.

Batch file is working from cmd prompt but not from IIB tool

I have wrapped a simple perl command in a simple windows batch file and executed the same from cmd prompt which worked as expected.
But if I trigger the same batch file from my message flow in IBM Integration Bus, it is unable to recognize the 'perl' command.
Provided the environment variables are set properly and the batch file is working fine from command prompt.
Can anyone please help me on this to identify the issue and resolve the same?
Thanks for the reply.
Actually the error was related to the path from where the batch is calling the perl command.
IIB was always executing it from it's runtime path and that's why it could not recognize the perl command.
The clue is to execute the batch from the path where the perl.exe is present. By following the same the issue got resolved.

Daily upload of file automation using batch script and WinSCP

So I do have a file that I generate weekly from a server using crontab in Linux side and transfer it to my PC. However, I am having a problem when try to send the file that I generate from a different server on Windows side using task scheduler.
Your command-line syntax is wrong.
I'm assuming the \ftpBinverlog_%yyyy%-%mm%-%dd%.txt is the file, you want to download.
It won't work, if you just specify it on command-line like you did.
Also neither Windows scheduler, nor command-interpreter, nor WinSCP understand syntax like %yyyy%.
The path to the remote file does not look good either. *nix systems use forward slashes, not backslashes.
So just keep your /script and /log arguments:
/script=C:\batchrun\Binver\script.tmp /log="C:\BIN VERIFICATION\ftplog"
And make sure the script.tmp looks like:
open sftp://user#example.com
get /ftpBinverlog_%TIMESTAMP#yyyy-mm-dd%.txt C:\target_path\
exit
References:
Guide to automating file transfer from SFTP server
%TIMESTAMP syntax.
Develop a batch file which will download/upload the required file using the SCP command
check this for more details.
check this for more details about the scp command parameters.
Make sure that you are able to run the batch with a successful result, then configure it within a scheduled task.
I hope this could help.

SVN update using windows task scheduler not working

I want to setup a windows cron job to update svn. I created a batch file with this step:
START TortoiseProc.exe /command:update /path:"C:\svn" /closeonend:0
and setup the task scheduler to run this daily. This svn requires a password which I want to enter each time rather than cache it. The batch file works as expected without any issues.
The task scheduler shows that the job was successfully executed. However, I don't get the GUI to enter the password, neither does the directory get updated. Also, when I tried to manually update the svn directory thereafter, it says that svn is locked.
Why is task scheduler reporting successful?
Why is svn getting locked?
Task scheduler reports success because START seems to return exit code 0. START only starts an application and exits. It doesn't wait until the started application has exited. The task scheduler never sees the exit code of TortoiseProc this way.
You can do this with START WAIT. Enter START /? in a CMD for more information.
You can also do this with CMD /K itself. Enter CMD /? in a CMD for more information.
But I don't think you need START or CMD at all. You can either run TortoiseProc directly or call it via a batch script. In the batch script you can add more debugging like echos and redirected output in files to see what happens.
Do not use TortoiseProc.exe for this task! Use Subversion command-line client (svn.exe). Read the docs:
Remember that TortoiseSVN is a GUI client, and this automation guide
shows you how to make the TortoiseSVN dialogs appear to collect user
input. If you want to write a script which requires no input, you
should use the official Subversion command line client instead.

Re-directing standard error to console and file [duplicate]

This question already has answers here:
Displaying Windows command prompt output and redirecting it to a file
(32 answers)
Closed 8 years ago.
I am trying to redirect both the standard out and standard error in a Windows batch file to the same file.
However I would like the standard error and user input prompts to be displayed in the console as well.
I tried the following:
Process_SVN_Repos.bat > Process_SVN_Repos.log 2>&1
However this causes the STD ERROR to go to
the file (which I want), but does not show up in console and hence I can not input any user required inputs because I don't see any user prompt.
So basically I am trying to:
Redirect all std out to a file.
Redirect all STD ERROR to the same file.
Also show the same STD ERROR on the console.
See the user prompt the application needs in the console and be able to input the user prompt.
You need a tee command for Windows. Here are few options:
Rob van der woude pure batch solution / ....
Dave Benham's jscript/bat hybrid
Tee by Microsoft - it's part of Unix services for Windows (after installation it's available in the BIN folder and has no exe extension) - For XP/Windows Server 2003 for Windows Vista, Windows 7, Windows 8, Windows Server 2008, and Windows Server 2012.
Command line co uk
UnixUtls
Windows doesn't have a tee command, so you can't. As Windows includes Unix you could use one of those shells. I don't know if it has tee, but it has 350 utilities.
If you are using a Unix environment then you can easily use the tee command. But since you are on Windows, it doesn't support you directly. But there are alternatives that you can use.
I have used Wintee for a similar task like yours. I suggest you use that small utility called wtee.exe. If that can't help your task there are other alternatives as well.

Resources