0

so i have a bat file that goes: powershell -noexit "My\file\location\myscript.ps1"

the bat file is in the start up. the powershell script changes the bcd. when executed in this manner it says i do not have privileges, access denied, and nothing in the bcd is changed.

sorry for being a newb, but is there a way to pass an elevated privileges value from the bat to the powershell script?

dwarf
  • 445
  • 2
  • 9
  • 23
  • possible duplicate of [PowerShell: Running a command as Administrator](http://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator) – jeb Jun 04 '13 at 19:50

1 Answers1

0

I don't know if this is possible to do from outside Power Shell but it can be done from inside. It's hacky but you could run a power shell script from your bat file that then launches the admin Power Shell session using "PS> Start-Process powershell -Verb runAs".

PowerShell: Running a command as Administrator

Community
  • 1
  • 1
DubiousPusher
  • 1,132
  • 2
  • 8
  • 19
  • 2
    Yes, it can be done from outside powershell, because you can invoke powershell.exe from cmd with a command. Here's what I normally do to start an elevated PowerShell session from the Run box, which should work just as well from a batch file: `powershell start -verb runas powershell` – Adi Inbar Jun 04 '13 at 21:17
  • Ok, did you get this working? Did you try "powershell start -verb runas /user:administrator"? – DubiousPusher Jun 05 '13 at 21:49