I want to enable IIS by Enable-WindowsOptionalFeature of powershell.there is a python program having one line code:
os.system('powershell.exe Enable-WindowsOptionalFeature -Online -FeatureName $(Get-WindowsOptionalFeature -Online | Where { $_.FeatureName -Like "IIS-*"} | Select-Object -ExpandProperty FeatureName)')
when I run the python program,it says that 'Select-Object' is not recognized as an internal or external command,operable program or batch file.
I search for many ways.But no one can solve this problem,can someone help me with this? Thanks.
is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + CategoryInfo : ObjectNotFound: CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
there are some gibberish not shown in the error. – 谭雪飞 Aug 04 '15 at 01:59
but it shows that:
You must provide a value expression following the '-Like' operator.
+ ... tureName -Like IIS-*} | Select-Object -ExpandProperty FeatureName)
Unexpected token 'IIS-*' in expression or statement.
is there a way to solve it?