I'm trying to run a PowerShell script inside cmd command line. Someone gave me an example and it worked:
powershell.exe -noexit "& 'c:DataScheduledScriptsShutdownVM.ps1'"
But the problem is my PowerShell script has input parameters, so I tried, but it doesn't work:
powershell.exe -noexit "& 'D:WorkSQLExecutor.ps1 -gettedServerName "MY-PC" ' "
The error is:
The term 'D:WorkSQLExecutor.ps1 -gettedServerName "MY-PC" ' is not recognized as the name of a cmdlet, function,
How can I fix this problem?
See Question&Answers more detail:os