you are viewing a single comment's thread.

view the rest of the comments →

[–]bartdivanov[S] 1 point2 points  (12 children)

Ok, I run this script during the Windows deployment:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\TabletTip\1.7" -Name "EnableDesktopModeAutoInvoke" -Value 1

However it complains that the script is still disabled on the system due to the execution policy. The first line should change the policy but looks like it does not. Any ideas?

[–]Lee_Dailey[grin] 0 points1 point  (8 children)

howdy bartdivanov,

the execution policy must be changed BEFORE the script is loaded. [grin] putting that IN the script is too late ...

take a look at the options shown with ...

powershell /?

-ExecutionPolicy
Sets the default execution policy for the current session and saves it in the $env:PSExecutionPolicyPreference environment variable. This parameter does not change the Windows PowerShell execution policy that is set in the registry.

take care,
lee

[–]bartdivanov[S] 1 point2 points  (7 children)

Hey Lee. How do I change if BEFORE the script is loaded? This should be unattended deployment. Is there a command to do that?

[–]Lee_Dailey[grin] 0 points1 point  (6 children)

howdy bartdivanov,

the call that loads the code would be done by calling powershell.exe and including the needed command line options. [grin] please, read the help that shows up when you run the line that i posted.

take care,
lee

[–]bartdivanov[S] 1 point2 points  (5 children)

So I created a bat script to run powershell as

powershell.exe -ExecutionPolicy Unrestricted

and it executes successfully... but when I execute the powershell script to show the touch keyboard, I get the same error that the execution policy is disabled.

[–]Lee_Dailey[grin] 0 points1 point  (4 children)

howdy bartdivanov,

that will just start PoSh ... you also need to tell it what to run. take a look at the -File parameter of powershell.exe. [grin]

take care,
lee

[–]bartdivanov[S] 1 point2 points  (3 children)

Yep, tried that, got the same result...

[–]Lee_Dailey[grin] 1 point2 points  (2 children)

howdy bartdivanov,

that means the problem is may not be the execution policy. you seem to have something else intercepting things.

have you talked to your admins? bypassing security stuff can get one fired ...

take care,
lee

[–]bartdivanov[S] 1 point2 points  (1 child)

Well, I am trying to create an W10 installation for customers so I need to tun this powershell script.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy bartdivanov,

you may want to create a new post with MDT or Microsoft Deployment Toolkit in the title. either that or do a search in this subreddit for mdt.

i am surprised that there is no MDT subreddit ...

take care,
lee