Running powershell network script at computer startup will fail - powershell

an Hyper-V Server 2019 attempts to run a network powershell script at computer startup, through the Task Scheduler, however this script will not run at startup, nothing happens.
Once the Hyper-V server has booted, if the script is manually launched through the Task Scheduler, it will run.
Could it be possible that the script will fail to run because the network is not available at that time?

As suggested by #Hazrelle, delaying the script start for 5 minutes did the trick. I have followed instructions in this article:
https://www.maketecheasier.com/start-scheduled-tasks-with-delay-windows/

Related

Launch a command on a server while a job has been launched with cron

I am wondering if I could launch a command on a server using the server terminal without interfering with my cron job that was launched automatically 1 hour away ? The server is an ubuntu, distant, with few resources, and I am communicating with it on PuTTY.
And second asking, do you know a command to check the amount of resources used by my running cron ? This is the command I would launch on the server right now.
Thank you in advance for your help,
Valentine
PS : for the moment, I didn't try anything because it is really important that my process running with a cron succeed.

The HTTP request to the remote WebDriver server timed out after 60 seconds. Happens only when running through the task scheduler

I'm troubleshooting an Selenium script that runs through the Task Scheduler on a Windows Server. It's running in PowerShell using version 3.0.1 of the Selenium module (found here:https://www.powershellgallery.com/packages/Selenium/3.0.1) with the Edge browser (the one with Chromium).
The "The HTTP request to the remote WebDriver server for URL [localhost] timed out after 60 seconds." error has been quite persistent and only appears when run through the Task Scheduler. The script runs fine when running manually through ISE.
Also to note, there's another script that is more or less the same as the one having the issue, albeit using a slightly different url (same site). This second script runs without issue through the task scheduler. They're performing the same sequence of actions which is why I'm not entirely sure why it would fail for one script but not the other.
I haven't found a suitable solution while looking at other posters facing the same issue. Any help is much appreciated!
I had the same issue. I tried all kinds of code changes but the only step that worked for me was to change the Security Options in Task Scheduler.
Task (right-click) > Properties > General > Switch from Run whether user is logged on or not to Run only when the user is logged on.
I guess this would be a temporary solution. I'll keep looking and update this if I find a better solution.

Remote Execution of "get-process" Fails, Couldn't Connect to Remote Machine

In my workplace, we administer hospital intensive care PCs (Windows 7 desktop clients) that are meant to be on and running a particular program in near-perpetuity. To that end we've developed a few powershell scripts that run every 5 minutes and alert us whenever the PCs drop off the network or the processes / programs we require crash.
Our program monitoring script relies on the powershell cmdlet "get-process" run remotely by an admin-credentialed account. The script works on all of our PCs except one and we haven't been able to determine what's causing the failure.
At its most basic, the command looks something like
get-process -computername [hostname]
When pointing toward our problem PC we get the error
Get-Process : Couldn't connect to remote machine
Our research indicates that this is likely caused by permissions, firewall, or remote registry service problems. We've triple-checked and on this PC and
the monitoring account has admin privileges, no firewall is active, and remote registry service is on and set to start automatically. The code works when run on the local machine but not when run remotely.
Similar powershell cmdlets run remotely, like "get-service", work with no issues. As noted above "get-process" runs successfully on our other PCs. Any insight into this strange issue would be appreciated.
One thing to note is that the Invoke-Command workaround that has been offered in answer to other, similar questions doesn't work on this PC or any of our others.
Have you tried validating the all RPC services are up?
1.Remote Procedure Call(RPC)
2.Remote Procecure Call(RPC) Locator
3.Remote Registry (You said it's up though)

starting windows application with powershell

I need to start up Outlook via Powershell script and schedule it.
The Powershell script is able to start Outlook when its run manually from powershell command prompt.
But when the same script is run via windows task scheduler I only see the process kicking off in background while there is no running instance of Outlook in the front end.
I wanted to know why the app is not launching at the front end.
Check what user the scheduled task is running as, unless it's running as the logged in user you won't see anything.
Outlook will launch, as a background process, but as it will be running as another user (likely system) you won't see the outlook window.

OutOfMemory with Ansible PowerShell Automation

I have a PowerShell script which performs a lot of in-memory data manipulation. It is used in a configuration process I am automating with Ansible Playbooks. When the script is run manually on the server, it finishes successfully, and the correct changes are observed. However, when I run the same script through Ansible, an OutOfMemoryException is thrown by PowerShell.
I've tried increasing PowerShell's allocated memory well beyond the expected size using,
Set-Item vsman:localhost\Shell\MaxMemoryPerShellMB [memsize]
This resulted in the same error. However, if I run the script on the server once before triggering the playbook, it seems to work, until I restart the machine.
For Ansible, my remote connection is configured using WinRM.
If you're running PS3, have you tried this hotfix as suggested in the Ansible Windows docs?