Quantcast
Channel: Configuration Manager 2007 Software Distribution forum
Viewing all articles
Browse latest Browse all 629

Powershell Syntax working when run in cmd, but when run through SCCM2007 Task Sequence it claims the syntax is incorrect?

$
0
0

The code below is a simple powershell statement which enables me to change the execution policy so that I can run powershell scripts. When I run this in a normal windows enviroment the statement will work fine, not giving me an issue whatsoever. However, whenever it runs in the task sequence the TS fails. I am running this via the command line option in the task sequence, each time running this step as 3 different types of administrators.

powershell.exe -noninteractive Set-ExecutionPolicy -ExecutionPolicy unrestricted

Checking the log file it states this:

Set-ExecutionPolicy : The term 'Set-ExecutionPolicy' is not recognized as the 	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)
name of a cmdlet, function, script file, or operable program. Check the 	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)
spelling of the name, or if a path was included, verify that the path is 	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)
correct and try again.	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)
At line:1 char:1	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)+ Set-ExecutionPolicy -ExecutionPolicy unrestricted	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)+ ~~~~~~~~~~~~~~~~~~~	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)+ CategoryInfo          : ObjectNotFound: (Set-ExecutionPolicy:String) [], 	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)
CommandNotFoundException	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)+ FullyQualifiedErrorId : CommandNotFoundException	InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)

InstallSoftware	13/10/2014 17:28:09	3768 (0x0EB8)

 Failed to run the action: Script Exception.
Incorrect function. (Error: 00000001; Source: Windows)	TSManager	13/10/2014 17:28:09	2716 (0x0A9C)

I am new to both SCCM and Powershell, but from my point of view, this should work, considering that the syntax is not actually incorrect? Please could anyone with any idea drop some hints and tips on how to stop this issue.


Viewing all articles
Browse latest Browse all 629

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>