I need to know when the database server has been started, something like when the dbsrv*.exe has been launched. (* for version 9 - 12).
There is a log accessible from the tray icon but with a limited number of rows so I can't see the start time.
Simply that: PowerShell command
Related
I am trying to catch the events when the windows on my system are created and destroyed.
However, I am facing some strange results:
Everythink works fine with some windows/applications, but with certain windows/applications the events I receive seem all mixed up.
For exemple, everything seems fine with Notepad.exe, but not with Calc.exe.
With Calc.exe, when I open it I get 2 x HSHELL_WINDOWCREATED and 1 x HSHELL_WINDOWDESTROYED.
When I close it I get 4 x HSHELL_WINDOWDESTROYED.
I am lost!
Here is in detail the result I get from the "ShellHook Messages" script (https://www.autohotkey.com/board/topic/32628-tool-shellhook-messages/):
(I just added the "Title" column. The titles are in French.)
I get the same stange behaviours when I track the events with :
the script "WinHook" (https://www.autohotkey.com/boards/viewtopic.php?f=6&t=59149)
or with a more direct approach (https://www.autohotkey.com/board/topic/80644-how-to-hook-on-to-shell-to-receive-its-messages/)
This is the script I use to open my windows:
#SingleInstance Force
#NoEnv
^j::
run notepad.exe
return
^k::
run calc.exe
return
I have Windows 10 Pro 21H2 19044.1645.
Any help appreciated!
Thank you!
On my old system (Linux Mint 18.3), every time I used the less command and quitted (q), the last viewed page of less remained on the terminal (bash) view
On my new system (Min 19.3), when I quit 'less', everything fades, as if less was never opened (similar to what happens with 'nano' command, for example)
Is there a way to make less behave like in my old system? It was very useful when working e.g. with git logs
From man less:
-X or --no-init: Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if
the deinitialization string does something unnecessary, like clearing the screen.
Does anybody know if it is possible to uninstall software through PowerShell if it prompts for user input? I have multiple scripts that can uninstall just about anything, except for the one software that I need it to uninstall. I'm specifically trying to uninstall PDFForge toolbar which is installed when downloading PDFCreator.
None of the scripts that I've written fail, they just hang when run, I believe because the uninstall process is asking for user input to proceed.
PowerShell isn't going to interact with the prompts... you can't just tell it to click "Next" in an executable because it can't see it.
You can send keys to it though. You're really just using COM objects.
So, first, get your process ID by setting a variable that contains an array, the data for which is defined by the name of your process. Let's say your process is called, "Uninstall" and the process is ALREADY RUNNING:
$a = Get-Process | ?{$_.Name -eq "Uninstall"}
Start the COM:
$wshell = New-Object -ComObject wscript.shell;
Bring the uninstallation program with this process ID to the front so we can send it keystrokes:
$wshell.AppActivate($a.id)
Give it a few seconds to bring that window forward. I chose 5, but if your machine isn't stressed, 2 is probably enough:
Start-Sleep 5
Now start telling it what keys you want to send. The syntax here is this: whatever is in the () is what will be sent. The position in the single-quote is the keystroke to send, after the comma is how long you want it to wait before proceeding. Assuming the first screen is "Next" you can send your first command by telling PowerShell to send the ENTER key and wait 5 seconds:
$wshell.SendKeys('~',5)
The wait function is optional, but for your purposes, you're definitely going to want it. (If you don't want it $wshell.SendKeys('~') would send the ENTER key and immediately move to the next command.)
Walk through the uninstallation yourself manually, using all keystrokes, and for any keystroke you send, pay attention to how long it takes before the next part of uninstallation is loaded, and wait longer than that with your script (e.g. if it processes your ENTER key instantaneously, I'd have it wait 3 or 5 seconds before it sends the next command. If it takes 5 seconds to load, I'd tell it to wait 10 seconds before sending the next command).
Letters are letters, and numbers are numbers. Most non-commands are just assigned to their keys (meaning if you want to type "K" your command would just be $wshell.SendKeys('K')) You can get the rundown for the specific keys here: https://msdn.microsoft.com/en-us/library/office/aa202943(v=office.10).aspx.
on Windows 7, how do I trigger on first occurance of an event each day to run a small batch file?
I'm trying to kick off a small batch script that runs only for a few seconds when I unlock my PC, but I only want it to run the first time I unlock my PC and never again until the I unlock my PC after 12AM of the next day. I can't tigger on specific time because the time at which I unlock my PC is random. I have been playing with task scheduler for days without success.
You could have the script set a state on first run, which keeps it from running again, for example by exiting immediately instead of doing anything when the state is set.
Then set up a task that triggers on log on to execute said script and another task that runs each day at 12AM to unset/remove the state set by the script. This should give you the effect you want.
A better solution, would be to have the script deactivate (f.e. via schtasks) the task triggered by logging on that called it and have the 12AM task restart the logon triggered task once each day.
I just faced the same problem, so here is my workaround without knowing to much scripting:
I created 4 .bat-files containing basically the following.
start application, afterwards replace bat-file1 with bat-file2
do nothing
replace bat-file1 with bat-file4
start application, afterwards replace bat-file1 with bat-file2
Now I created to scheduled tasks:
The first one runs every day at 12am and runs batch-file 3. Hence, it replaces bat-file1 with bat-file4.
The second one runs after every unlocking of the computer and runs batch-file1.
As you can see in total it does exactly what you want, although it might be a little bit complicated...
On your first unlock it starts your desired script and replaces itself with a dummyfile (the batch file only contains the word exit). After every following unlocking nothing but a hardly noticable cmd popup happens.
At 12am the dummyfile is replaced by the initial batch-file again, to provide your task in the next morning.
I am using Tera term to control multiple serial channels (6).
I am connected to all of them at the same time.
I would like to apply the macro at the same time on all the windows.
I have been looking around but not been able to find a solution.
I wrote a batch file that call teramacro.exe and connect to each port. But the macro is done one port at the time while I would like to see it synchronously. If I cut my script in single actions, the batch file then try to open a new window (unsuccessful since a previous one is already connected).
Regards,
Marc
Try this in your batch and it works
start ttermpro.exe /F=config1.ini
start ttermpro.exe /F=config2.ini
you can open multiple teraterm windows. All the opened windows are shown as tabs below the window (just like task manager in windows OS)