I am able to run get-services from powershell command window/ise but when I schedule the same script in SQL agent job and execute, it is failing with cannot open service control manager.Can anyone share your experience on this. Am I missing something?
Could be a matter of permissions. What account is the sql agent job running under? And how are you trying to execute PowerShell commands?