I have a powershell script which loops over each file in a folder and does a lot of "high-computation" tasks on each of these files. I have multiple instances of this script running on my system.
I do use a write-host before starting each of these tasks to see when these tasks start and end.
I started these instances of the script last night and when I came today morning I noticed that some of my powershell terminal were stuck at a write-host command and when I pressed ENTER they wrote that content to terminal and continued the preocessing.
It looks like some of these terminals go to sleep. Why am i seeing this and how can i prevent this?
Disable the "QuickEdit" option in the "Windows PowerShell" Properties window.
Right click the PowerShell window to get the to the Properties window.
Related
We are using web project unfinished, and everytime the computer start, we need to go to:
c:/wamp64/www/
In this folder we have a folder "projectname", we have to shift right click , and open powershell windows here.
then we have in the terminal: PS C:\wamp64\www\projectname> (and here we have to write "node server.js") and enter.
This have to be done once wamp is open, this is the reason of the delay.
How can we do that automatically at windows start up after 30s ? that way we won't have to do that every time we reboot a computer.
thank you for your help
I would use the task scheduler for that purpose.
Open Task Scheduler by pressing “Windows+R” and then typing “taskschd.msc” in the window that opens. Then take the following steps:
Click “Create a task” and enter a name and description for the new task. To run the program with administrator privileges, check the “Run with the highest privileges” box.
Switch to the Triggers tab and click the “New…” button. Here you can specify the conditions that trigger the task to be executed. For example, you can have it executed on schedule, at logon, on idle, at startup or whenever a particular event occurs.
Choose At log on then set it to run for Any user and set the delay to 30 seconds
Navigate to the “Actions” tab, and click “New…”.
To schedule the PowerShell script, specify the following parameters:
Action: Start a program
Program\script: powershell
Add arguments (optional): -File [Specify the file path to the script here]
References
How to automate powershell scripts with task scheduler
I'm trying about three days to run and get result from Update-AzureRmVmss command using powershell. However after lasting 20-30 minutes of waiting, it ends with offering reconnect or quit pop-up window. Is it related with azure infrastructure? Can not azure update vmScaleSet faster?
I need to from time to time update custom script extension and apply changes to virtual machines.
Any help would be appreciated.
Solved!
The problem was in my custom script extension. After downloading and running application there was -Wait command at the end of script. That was causing process to not finish
I have a PS script that opens Excel (Com Object), processes a bunch of information, re-saves, and then sends some critical information via e-mail. The script runs great, and when I run it from the Run Console, it works great as well. However, when I schedule it as a task in the Task Scheduler it is not working properly. The task seems to "successfully run" every single time, but I do not get the output e-mail that I am supposed to get. I have run many other PS Scripts without a problem using the same configuration in the task scheduler. Could this have something to do with opening Excel as part of a script scheduled? Any thoughts are welcome.
I solved this issue using the answer from #briantist in PowerShell script won't execute as a Windows scheduled task, but I wanted to isolate exactly which switch was solving the problem.
It had nothing to do with -ExecutionPolicy, -Noninteractive, -NoLogo, -NoProfile or any other system privilege, user account running the script, etc.
Just needed to add -File in front of the script path in the Task Scheduler > Actions > Arguments field. Without this switch PowerShell was launching and the task history was showing Action Completed, but the script was not executing.
I'm using Genymotion to run WhatsApp on Ubuntu 13.04 as I don't own an Android.
To get to Whatsapp everytime I login, I have to
1) open terminal and run ~genymotion/genymotion
2) click a button on the GUI which opens up another new window (play button).
3) wait for about 30s for the device to get ready.
How can I make the computer do these first two steps automatically for me at start up?
Even better if it possible to do them in background, i.e., I shouldn't see the GUI opening. It should perform the steps and be "minimized".
I was thinking if there was a way to record what my click does and then put it in a script.
Something like a strace command.
I hope my question is clear enough. I'm relatively new to Linux.
For now Genymotion allows you to start a VM from the command line, by calling the "player" binary, and passing the VM name as a parameter.
You could write a shell script that:
run: <GENYMOTION PATH>/player --vm-name <VM NAME>,
wait some seconds for the VM to boot: sleep 10,
then use adb to start your Application: adb shell am start -n com.whatsapp/com.whatsapp.Main
Luckily, no need to simulate clicks for this.
In my powershell script I call a handful of batch files. For each batch file I get the "publisher could not be verified warning" and I have to click run for it to work. This poses some problems for automating this script
Without changing settings on the machine itself, can I make this issue go away?
When you right clic on these script files in explorer do you see in the general tab :
Security : this file come from ...
you can remove it using :
echo "">file.ps1:Zone.Identifier
You'll find more explanation here :