Jump to content


ejuliorod

Powershell script not running from task sequence

Recommended Posts

I have a PS script that I run with an admin account that does not run during the task sequence.

The log file shows access denied.

 

I am using a command line because the Run Powershell task does not let me specify an account to use. (I get access denied with that one also)

 

This is my command line - powershell.exe -file myscript.ps1 set-executionpolicy bypass

 

This script runs just fine if I run it via TS when Windows is up and running, it just does not work during the TS when Windows is in provisioning mode.

 

Any ideas?

Thanks

 

 

Share this post


Link to post
Share on other sites

What does the script do and a what time in the task sequence are you using it?

We are using "Install Applications according to a dynamic variable list" to install our apps. This PS script is used at the end of the task sequence to clean out the variables placed in the computer Properties Variables tab. It works fine when running within Windows but cannot get it to run via task sequence when Windows is still in provisioning mode.

I am running a command line in the task sequence running with an admin account

This is the error in the log:

 

File C:\_SMSTaskSequence\Packages\SA100154\RemoveOSDVariables.ps1 cannot be
loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecord
Exception
+ FullyQualifiedErrorId : UnauthorizedAccess
I use the same account in the task sequence to launch VB scripts.
Thanks for your help

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.