I would like to run a powershell script with the K1000. I have the powershell script as a dependency, and the Script Text as

powershell.exe -executionpolicy unrestricted -file "script.ps1"

I named the script script.bat

When I run the script I receive the following dialog:

2011-10-25 15:09:18: Alert not enabled, moving to next phase....
2011-10-25 15:09:24: Sending script script.bat to client....
2011-10-25 15:09:29: Script sent
2011-10-25 15:09:29: Sending dependency script.ps1 to client....
2011-10-25 15:09:36: Dependency sent
2011-10-25 15:09:36: Executing script....
2011-10-25 15:09:59: Error 1 received while executing script

Does anybody know what error 1 means in this context? Has anybody been able to execute powershell scripts by any other method?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Is that debug logging?

Did you test calling this batch (which calls your powershell) from a command prompt running as SYSTEM outside the kbox?
Answered 10/25/2011 by: GillySpy
Seventh Degree Black Belt

Please log in to comment
0
The log came from the Run Now Status run failures log.

I am able to run the batch as local system without any issue.
Answered 10/25/2011 by: muebel
Tenth Degree Black Belt

Please log in to comment
0
I included a powershell script in one of my MIs. In the setup.bat I have:

::Allow powershell scripts to run
powershell Set-ExecutionPolicy RemoteSigned

::Set Sort Memory
IF EXIST "C:\Windows\SysWOW64" (
powershell .\x64.ps1
) ELSE (
powershell .\x86.ps1
)

Casey
Answered 10/25/2011 by: cmccracken
Orange Senior Belt

Please log in to comment
0
MI = Machine Image?

Have you pushed out any powershell scripts?
Answered 10/25/2011 by: muebel
Tenth Degree Black Belt

Please log in to comment
0
I ran into this once and the problem was a space in one of the directories messed up the path to the powershell script so the script was never executed, my solution was to call the Powershell EXE directly with the following settings:

Launch a program:
Directory: C:\Windows\System32\WindowsPowerShell\v1.0
File: PowerShell.exe
Parameters: -nologo -executionpolicy bypass -noprofile -file "$(KACE_DEPENDENCY_DIR)\PowerShellScript.ps1"
Answered 10/25/2011 by: jrscribner
Purple Belt

Please log in to comment
0
MI = Managed Install.

Casey
Answered 10/26/2011 by: cmccracken
Orange Senior Belt

Please log in to comment
0
Thanks for the tip jrscribner.

I configured an online shell script with the powershell script as a dependency, and the batch script as:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nologo -executionpolicy bypass -noprofile -file "$(KACE_DEPENDENCY_DIR)\script.ps1"

When I did this I received a new error:
2011-10-25 19:40:49: Executing script....
2011-10-25 19:40:55: Error 4294770688 received while executing script

When I set up the Online KScript as you described... and I seem to have had the same behavior with any way I set it up, I run the script and it just hangs at "status pending"

But yeah, error 4294770688... uh google had nothing to say on that one. Anybody have any idea for the source of this particular error code?
Answered 10/26/2011 by: muebel
Tenth Degree Black Belt

  • hope you already solved it until now. But the Error Code "4294770688" is decimal and in hexadecimal the error means 0xFFFD0000 what seems to me to have to do with the execution policy. I'm getting currently an similar error during installation with sccm and am not able to fix it..
Please log in to comment
0
Thanks for the tip jrscribner. I was having trouble with an off-line script executing a powershell script. I added quotes around the script path argument, and that fixed it.
Answered 01/02/2012 by: zookdj
Second Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity