Skip to content

Powershell script not running from task sequence

Featured Replies

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

 

 

Just a shot in the dark, does it make any difference if you specify the full path to the powershell.exe

 

C:\Windows\System32\WindowsPowerShell\v1.0

  • Author

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
  • Author

I would do something like that via a Status Filter Rule. That saves a lot of problems with permissions and task sequences.

Thanks I will give that a try..

  • Author

Just a shot in the dark, does it make any difference if you specify the full path to the powershell.exe

 

C:\Windows\System32\WindowsPowerShell\v1.0

Did try this but same results, thanks for your input

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.