You can script most frequently used commands of the Log Reader command-line interface and execute scripts directly in a PowerShell console.
Tip: To create a CLI script for the Log Reader, enter the script in a word processor and save it as a .ps1 file.
To execute a Log Reader CLI script
In PowerShell, execute the following command:
& [Path]
where Path is path to the script.
To schedule Log Reader CLI script execution
In the Run field, enter the following command:
"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -PSConsoleFile LogReaderSnapIn.psc1 -Command ". script.ps1"
where
%SystemRoot% is an environment variable with the path to your system root directory (usually, C:\WINDOWS),
LogReaderSnapIn.psc1 is the full path to a previously saved PowerShell console configuration file and script.ps1 is the full path to a script file. For more information, see To save PowerShell console configuration.
Troubleshooting: If you receive a "File [path] cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details." error, run the "Set-ExecutionPolicy RemoteSigned" command to disable security restrictions and execute the script again.
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center