I have a batch file that runs a piece of R script, which scrapes some websites and results in two actions: (1) save the data and (2) send it to me through email.
I want this to be done on a daily basis during the night so that each day in the morning I will have some updates. So I set a task in Task Scheduler that runs at 2am each day. However, it didn't work as intended. I could see the website were scraped and the data were saved (by checking modified time), but never got the email.
Pretty sure both the R script and the batch file works perfectly if I run them in the normal way. More strangely, if I set the task to be triggered at, say, 10am when I am normally logged in and using the PC, everything works just fine and I can get the email.
So the only difference is that at 2am my PC is locked (not logged out) whereas at 10am I am using the PC. However, I have ticked the options 'run whether user is logged on or not' and 'run with highest privileges' in Task Scheduler anyways, so I cannot see where the problem is. Any help? Thanks!
Tried various setting options in Task Scheduler but didn't work.
Related
I have one script that asks a few computers via invoke command once an hour for 7 hours and it works fine. The computer locks still runs.
I have other scripts that query thousands of computers and if the computers locked it's like permissions are blanked and it stops working. I can't explain it. And everything I Google pulls up bad information due to keywords. I don't have example code. But for example I'm listing a specific directory in every computer and it fails when I log out. I don't have 15 hours to wait for the script to finish. I am sorry for no code but I don't know where else to ask. Just some direction pointing and I can figure it out. Please.
Trying to follow this guidelines https://github.com/vstarostenko/dv8p_wifi_issue_fix/blob/master/README.md I have now a Powershell script that works, but that is not triggered with event 507.
The script works if manually run through Task Scheduler (in windows 10) (shown by history record and because I have an alert in the script that displays a message)
The 507 event is shown in the event-viewer when it moves back from standby
And the marked options in the Task appear to be correct (see below)
*But the script doesn't run in response to the event
Any idea?
I tried running the task not based on the event but on a particular minute, and it worked.
Then I tried to do the same event trigger, but then something changed. I did exactly the same but in the "Source" input, except saying Kernel-power, it now says Microsoft-Windows-Kernel-Power, having selected the same.
And now it works.
My assumption, I updated 2 days ago the system and it downloaded several critical files (I didn't pay attention, but it sounded to me to the first windows10 pseudo-service-package that I read few days ago). I guess that they corrected the bug(?), but that it still persisted until I have re-done the Trigger again.
Anyway, now it works :)
I wrote an extremely lengthy script that creates a form. The main purpose of it it to connect to vCenter servers, total up hosts/vms within different datacenters and also identify ESXi host versions. Running the script in ISE the form loads fine and when I click the Button to start the many various functions to update the fields, it runs. I have Foreach() fields throughout and added in a little StatusLabel to the bottom of the form to show me where in the script it is currently scanning.
Once all was done and working, I saved the PS1 file and moved it to a shared server to be run. When I run the Powershell console (as Admin) and point to the file, the Form loads ok. Once I click the button to begin generating the info, It just changes to (Not Responding) and grays out. I know it's working and if left there long enough it will return the info.
Why does the console window not function like the ISE? I want to be able to see the information and Status Label update/change as it goes through the script (just like I do in the ISE).
Appreciate the feedback. The script is several thousand lines long and would need to be scrubbed before I upload. Was hoping to just get some general info before doing that.
I updated to v4 and verified that my command window was running as STA using the command from Jan Chrbolka. Script runs properly now.
I was also facing the same issue.(Btw, I cannot upgrade Powershell to V4 right now since it is my company owned one.)
The Browse button that I incorporated in my form was not working when I am lauching it from Powershell command line. It went to Not Responding state when I click the browse button.
I took the advise from Jan ChrbolkaMay about the STA and MTA.
I checked for the threads related to that and changed the script execution format to the below one which fixed my issue.(adding the word -STA)
powershell -STA -File D:\PS\GUI.ps1
For checking the current state. Use the below query in Commandshell as well as ISE.
We have a legacy server service running on a Windows 7 desktop that keeps crashing with a popup window reporting a memory error. The popup stops all processing on the machine. Once the "OK" button is clicked on the popup the system recovers and moves on. The root problem appears to be inside a compiled DLL that the application uses.
This popup usually happens between 9pm and 11pm every couple days.
It happens when no one is signed into the PC, so the popup displays in front of the CTRL+ALT+Delete message for signing in.
I can click OK and it continues processing, signing into the computer.
CHALLENGE:
This is a legacy application that will be replaced when budget allows (maybe next Summer) so there is no budget for upgrade or paying a consultant to fix the root problem.
All we need to do is click the OK button when the "Application Popup" event is thrown (logged in the Event Manager)
I know that it would be WRONG to write a script to satisfy the popup. Fixing the root cause is the CORRECT action.. but we have no support to spend money at this time. And since it's a compiled DLL, we can't fix the code.
Is there a PowerShell script that could:
Watch for a specific event "Application Popup" and if it occurs simulate pressing the ENTER key?
Run in the background, signed out of a user account.
If PowerShell isn't the answer, is there a better macro or script tool to get us by?
I know it's "bad practice" but we just need to get along until we get some budget dollars.
Powershell probably isn't the best answer in this case. I'd suggest using something like AutoIt (the WinWaitActive function would be useful in your case).
I have used AutoIt in the past and have found it very useful for Windows GUI automation.
Hey I have a scheduled task going which basically laucnhes a .aspx page with IE Explorer, i know theres better ways of doing this i.e console apps etc but im stuck with this for the moment.
So the scheduled task runs fine and launches the ie and the page and the script on the onload on that page runs fine to. But the IE window stays open and the tasks remains as "Running". Preventing it from running the next time its due to run.
How can I get the scheduled tasks to stop "running" and maybe even close that IE windows cheers!
If you're looking to just make a HTTP request to the page, instead of opening a browser window, (get Firefox, okay?), you could launch curl http://server/path/to/script.aspx which is a command-line app, which makes the request and then quits immediately after.
For this, you'll need to download curl from http://curl.haxx.se/latest.cgi?curl=win32-ssl