SQL Server Agent with CmdExec job runs PowerShell infinitely

Just ran into this issue and solved it by using powershell -ExecutionPolicy bypass C:\path\to\script.ps1. Seems there was an issue with the signed module so I just set it to not check the sign.

Chrissy is a Cloud and Datacenter Management & Data Platform MVP who has worked in IT for over 20 years. She is the creator of the popular SQL PowerShell module dbatools, holds a master's degree in Systems Engineering and is coauthor of Learn dbatools in a Month of Lunches. Chrissy is certified in SQL Server, Linux, SharePoint and network security. You can follow her on Twitter at @cl.

Posted in PowerShell