How to stop the DebugView tool through command line parameters - debugview

In my project I want to start the DebugView tool through command line parameters to capture kernel logs automatically, but after finishing a task I want to stop this DebugView tool. How do I stop this tool through command line parameters?

It depends on what you want,
You could:
taskkill /IM dbgview.exe
But that might not guarantee all logs a written to the output file (I'm not sure what would happen).
You could use Debugview++ UI from https://github.com/djeedjay/DebugViewPP/releases
And define a 'stop' filter. This would stop the scrolling, but not stop collection of the data.
Leave a comment at https://github.com/djeedjay/DebugViewPP/issues/270 which I just filed to add a commandline option to do just this ;) And I will implement it.

Related

How to launch a script that execute a check disk (chkdsk) without manual confirmation in Powershell?

I have a supervision tool that can deploy scripts on customers end devices.
I'm trying to make two powershell scripts.
The first one is supposed to launch a "chkdsk disk_name: /f /r".
The second one is supposed to extract the result of the chkdsk after the reboot from the event viewer.
The second script is operational. My problem is with the first one.
I think that when I'm launching my job from my administration tool, the script is launched on the end device, but when you type "chkdsk disk_name: /f /r" on a command prompt, it asks if you want to do the chkdsk at the start of the machine because the disk is actually in use. I think that the letter "Y" that you have to type to confirm, is blocking the execution of the command (and my script by consequence).
I didn't find in the documentation of the command any method to launch it with a "default confirmation".
Do you have any idea of what I can do to automate this?
Sorry for my English, it's not my native language.
Thank you all!
I tried to launch the script (it's in admin mode when my administration tool launch it's job) but the result was that my job was running indefinitely and at the restart of the machine, the check disk is not performed.

Is there any way to have powershell automatically run a command anytime a command is run

I'm wanting to be able to have PowerShell automatically run a specified command anytime anything is run in PowerShell(hitting enter, any command at all). I've searched all over google with no luck finding anything except the way to have a command run on startup of powershell
If you need it a bit hidden you could do it with a ScheduledTask and Auditing Events.
Enable Auditing to get all changes logged as events
https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/whats-new/script-logging?view=powershell-7.2&viewFallbackFrom=powershell-6
Create a Scheduled Task that starts with a trigger from Events by ID. Take the IDs from the Microsoft article above. Add the command you would like to run as action. This means command is "PowerShell" and parameters are like -NonInteractive -Windowstyle minimized -c "command was executed | out-file c:\temp\activity.log"
Set it to be run as the user "system" if you want it at full permission without user interaction.
Don't forget this task to be allowed to run multiple times if you want it to.
Be aware that this might generate a lot of log entries and a lot of powershell processes depending on how log your task will run.
But in most cases the solution mentioned by Mathias R. Jessen above might be the easiest one, but is also easy to be changed by any user for the session even if you changed prompt in the settings mentioned here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.2

jmeter start in no pause mode from command line

I have a test plan in JMeter using some Timers.
In some situations I would like to execute the test plan from the command line with all Timers disabled (Same as with the Menu Option "Start no pause"), is it possible to use this option from the command line?
It is not possible as of jmeter 2.13.
You should open an enhancement request.
A possible way to do it is to make timers use a property as pause and pass it as command line property with:
-JmyPauseProperty=0
Edit 10 may 2015:
You created bugzilla enhancement:
https://bz.apache.org/bugzilla/show_bug.cgi?id=57912

Restarting PC's and writing to the event log with a custom message

I have written a script in PowerShell that will remotely restart a list of PC's using the 'Restart-Computer' command.
Is there a way of adding a custom message to the systems event log, to explain that the computer has been restart by my script.
Here is the PowerShell code that I used to solve this problem as suggested by the user C.B. above.
Shutdown /r /f /m ComputerName /d P:0:1 /c "Your comment"
This code will force (/f) a shut down and reboot (/r) of a given PC and write to the event log with a custom comment (/c). Note that to write a custom comment a reason code will need to be supplied using the (/d) parameter. Also note that the order of parameters matters.
For a list of reason codes and syntax follow the links below.
http://ss64.com/nt/shutdown.html
http://technet.microsoft.com/en-us/library/cc732503(v=ws.10).aspx

What does the EC2 command line say when a machine won't start?

When starting an instance on Amazon EC2, how would I detect a failure, for instance, if there's no machine available to fulfill my request? I'm using one of the less-common machine types and am concerned it won't start up, but am having trouble finding out what message to look for to detect this.
I'm using the EC2 commandline tools to do this. I know I can look for 'running' when I do ec2-describe-instance to see if the machine is up, but don't know what to look for to see if the startup failed.
Thanks!
The output from ec2-start-instances only returns you stopped pending, and as you say you need to use ec2-describe-instances to retrieve the state.
For that, you have a couple of choices; you can either use a loop to check for instance-state-name, looking for a result of running or stopped; alternatively you could look at either the reason or state-reason-code fields; unfortunately you'll need to trigger the failure you're worried about, to obtain the values that indicate failure.
The batch file I use to wait for a successful startup (fill in the underscores):
#echo off
set EC2_HOME=C:\tools\ec2-api-tools
set EC2_PRIVATE_KEY=C:\_\pk-_.pem
set EC2_CERT=C:\_\cert-_.pem
set JAVA_HOME=C:\Program Files (x86)\Java\jre6
%EC2_HOME%\bin\ec2-start-instances i-_
:docheck
%EC2_HOME%\bin\ec2-describe-instances | C:\tools\gnuwin32\bin\grep.exe -c stopped > %EC2_HOME%\temp.txt
findstr /m "1" %EC2_HOME%\temp.txt > nul
if %errorlevel%==0 (c:\tools\gnuwin32\bin\echo -n "."
goto docheck)
del temp.txt
ec2-start-instances will return you the previous state (after last command to instance) and the current state (after your command). ec2-stop instances does the same thing. THE PROBLEM IS, if you are scripting and you use -start- on a 'stopping' instance -OR- you use a -stop- on a 'pending' instance. These will cause exceptions in the command line tool and NASTILY exit your scripts all the way to the original console (VERY BAD BEHVIOR, AMAZON). So you have to go all the way through parsing the ec2-describe-instances [instance-id] result. HOWVER, that still leaves you vulnerable to that tiny little bit of time between when you GET the status from your instance and you APPLY A COMMAND. If someone else, or Amazon, puts you into pending or stopping, and you then do 'stop' or 'start respectively, your script will break. I really don't know how to catch such an exception with script. Bad Amazon AWS, BAD DOG!