How to call PowerShell script from Python.
I Have installed Python 3.7 and Powershell 7 version
I am running the below python script to call a PowerShell script
import subprocess, sys
p=subprocess.Popen(["c:\program files\powershell\7\pwsh.exe". "c:\scripts\abc.ps1"], stdout=sys.stdout)
Getting the below error
File “c:\program files\Python37\lib\subprocess.py”, line 775, in_init_ restore_signals, start_new_session)
I cannot tell nothing about Python but when you run
in a CMD or PowerShell console it will tell you the proper syntax to call PowerShell with a script file.
BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance
How to format code in PowerShell.org
Please I tried adding users to an organization unit using PowerShell script it worked but the users are not showing on the organization unit. PowerShell scripts. it was created on my member server .What do I do