close tcp\udp connection by process name without killing the process Autoit script - process

I need help with this autoit script
It's close a tcp\udp connection of a process without killing the process
I found script in a forum but it's not working
let's say I want to close any connection established from "internet download manager"
so I put in process name
$processname = "IDMan.exe"
but it still not working !!
I guess some thing wrong in the code
Second : I want to but a WHILE loop to kill the process connection whenever it started
how can I do that
Here is the script without modifications
Link to script
sorry I tried to put the script source here but I failed

What you need is an Admin Rights.
Add this to the top of your script
#RequireAdmin
You can use CloseTCPConnectionByProcessName in a while loop, just add some sleep to keep it stable.

Related

How to run DOS/CMD/Command Prompt commands from VB.NET and want to hold its terminal output for few seconds?

How to run DOS/CMD/Command Prompt commands from VB.NET and want to hold its terminal output for few seconds. After that it should be close automatically.
Depending on your goal, there could be multiple solutions to this request.
This SO post details how you can run a command from cmd.exe, passing arguments.
How to run DOS/CMD/Command Prompt commands from VB.NET?
Another idea, depending on the goal, would be to save the cmd as a batch file or similar, where you could have a pause or timed wait before the cmd window closes.
Then you could call the batch file from vb.net
I don't want to dive too deep into how each of these would be done without knowing more about the goal at hand.

WLST Scripting Error - Must Activate Changes Bug

I wrote a script to automate Weblogic deployments and during the undeploy and sometimes the deploy part of the script there is an error message that says, "The task cannot be processed further until the current edit session is activated. When this occurs, task processing will continue. The user can exit the deployer tool without affecting the task." When this happens I have to click the "Activate Changes" on the GUI of the admin console for the script to continue and do what I want it to do. Are there any WLST Jython programmers out there that know how to avoid this issue? I am trying to run the script without touching the GUI.
Also, sometimes the State of the managed server changes to 'deploy initializing'. When this happens I know that things are really messed up. I think this happens when I choose the other option "Undo All Changes".
There is a good answer of code for this in this blog
Its best to always do small bits, activate those changes and then proceed to the next task.
When doing an undeploy and deploy, its always better to undeploy, activate the change and then do a deploy and activate again, this way things remain clean else you may have conflicts when activating all changes in 1 go.
and no you dont have to activate from console, you can do from wlst using activate([timeout], [block])
Ensure to commit one transaction per session. This way you would not miss your earlier undeploy/deploy status due to the issue incurred by current deploy/undeploy task. Please find sample code block below.
app-list = [app1 app2 app3 ... app60]
for app in app-list:
edit()
startEdit()
app-path = "<path-to-your-apps>/" + app
deploy(app, app-path, targets=<your-targets>)
print 'deployed ' + app
activate()

Giving keyboard inputs to a nohup program

I know that when doing some ssh, I can use the nohup command to prevent a program execution from halting when I close the ssh session.
However, I need to run a program that takes some keyboard input at the beginning. When I run it, I am prompted with several questions that I need to manually answer, then the program will actually start doing what it is meant to do and then I would like to close my connection and let it run in the background.
How can I do this? My ideal solution would be some sort of "persistent ssh session" or so, something that would allow me to start a program, give it inputs via keyboard, the program gives me terminal output, then I close the connection, open it again and still see the program running, its output and so on, like if I just opened it without disconnecting and reconnecting.
Is there any way to do such a thing?
Thank you very much.

Read Output From A Running Process Realtime (Command Prompt)

I have been researching for an answer for my question for a long while using Google and changing what words I use in-case I find my answer, I have had no luck.
What I want is to the read the output from a process in real-time, not when it finishes the command it has been given. I have a command that I use which doesn't end unless the user ends it manually, closes the form or an error occurs. So every timer interval I would like to read the output from the command prompt (process).
I use background workers to start the process so it doesn't interfere with the form if that is any help.
Thanks in advance.

How kill a specific process

I have a process that interacts with an Excel application in background, but sometimes the process has an error and the Excel Application doesn't finish correctly.
Always, when this process starts try to delete the Excel file from the hard drive.
But, when the process has an issue and I retry to run the process again, the following message shows me when I try to delete the Excel file:
"The process cannot access the file [Excel file path] because it is being used by another process."
I can not kill all processes of Excel.
Then, my question is:
Is there some way to know what is the process that manage this Excel?
Or, Is there some way to know the process using a Try ... Catch structure?