0

to work with EntityFramework Migration, I need to have access to PowerShell, which I don't have in my company for some security reasons.

is there any way to run these command, without have access to PowerShell?

here is the error get when I start Package Manager Consoleenter image description here

VahiD
  • 1,014
  • 1
  • 14
  • 30
  • 1
    Well, talk to your admins/manager about this. The company decided on a policy. If you need PowerShell to do the job you were hired for it's their job to revise the policy, not your job to work around it. – Ansgar Wiechers Dec 17 '16 at 20:56
  • they proposed to work on a remote server, but remote server reduced my performance by 50% at least. anyway, forget about the policy, is there any way to program migration and other EF stuff without interacting with PowerShell or not? – VahiD Dec 17 '16 at 21:58
  • Are you _sure_ that it is their policy to block powershell in this way and did you try @Priyanka solution? `Set-ExecutionPolicy Unrestricted -Scope CurrentUser` – Andrés Robinet Dec 18 '16 at 05:32
  • I tried, but not worked for me, it's been restricted through group policy. – VahiD Dec 18 '16 at 06:40

2 Answers2

1

follow this steps :

  1. Run Powershell with administrator privilege
  2. Type this command :

    Set-ExecutionPolicy Bypass -Force

  3. Press Enter

  4. Restart you're program

and if u don't have access to powershell follow this way :

  1. go to Regedit.exe and follow this path :

    HKEY_LOCAL_MACHINE\SOFWARE\microsoft\powershell\1\shelllds\microsoft.powershell\executionpolicy

and change of this string value Bypass

  1. go to this address :

    HKEY_LOCAL_MACHINE\SOFWARE\microsoft\powershell\1\shelllds\Scripted.diagnostic\executionpolicy

and change this value to bypass

saftargholi
  • 896
  • 1
  • 9
  • 25
  • not useful, the powershell has been restricted through Group Policy, I can't run it. I need a solution to run EF command without PowerShell, kinda programming it – VahiD Dec 18 '16 at 06:40
  • @vahid : agha vahid too rahe dovvomi ke neveshtam powershell run nemishe faghat registry hast . amma age manzooretoon nuget hast oon commandash tahte powershell run mishe . – saftargholi Dec 18 '16 at 08:06
  • khob bade dastkariye registry ham baz nemitunam powershell ro run konam, va vaghti powershell natune ejra beshe (chon az tu GroupPolicy baste shode) nemitunam command haye package manager ro run konam. man donbale rahi hastam betunam masalan add-migration ro bedune niaz be power shell run konam, zaheran ye rahi hast beshe tu visual studio add-on nevesht bara in kar – VahiD Dec 21 '16 at 11:04
  • are ye add-on hast ammma kar nakardam age chizi didam minvistam baratoon . amma be default az powershell estefade mikone . – saftargholi Dec 21 '16 at 14:28
  • albate ye mozoo ham hast in mostaghiman az powershell estefade nemikone az ye kernel mesle oon estefade mikone . yani resource hashoon ro az ye ja migiran mesle policy , ... – saftargholi Dec 21 '16 at 14:28
0

You will have to set the execution policy. By default it's restricted that's what blocking the execution. Just run from PowerShell command prompt!

Set-ExecutionPolicy Unrestricted 

If you don't have admin rights, you can set the policy just for yourself!

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Remember to run them as command not as a script.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328