locked
Basic Powershell task - errors -Just trying to run excel, hidden on startup at each login. RRS feed

  • Question

  • Powershell.exe -File C:\ProgramFiles(x86)\MicrosoftOffice\root\Office16\excel.exe -ExecutionPolicy Unrestricted
    Start-Process -WindowStyle hidden -C:\ProgramFiles(x86)\MicrosoftOffice\root\Office16\excel.exe

     ####################################################################

    Error I get from Above:

    PS C:\WINDOWS\system32> C:\Temp2\be9.ps1
    File C:\Temp2\be9.ps1 cannot be loaded because running scripts is disabled on 
    this system. For more information, see about_Execution_Policies at 
    https:/go.microsoft.com/fwlink/?LinkID=135170.
        + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordExc 
       eption
        + FullyQualifiedErrorId : UnauthorizedAccess

    Help me out please.

    CT

    • Moved by Bill_Stewart Friday, March 15, 2019 7:30 PM Unanswerable drive-by question
    Tuesday, February 12, 2019 2:51 AM

All replies

  • What you are asking and the code posted make little or no sense.

    If running scripts is disabled then you cannot run any scripts.  We cannot help with this.  Ask your admins for help.


    \_(ツ)_/

    Tuesday, February 12, 2019 7:03 AM
  • I run this:

    PS C:\WINDOWS\system32\WindowsPowerShell\v1.0> Start-Process -"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"

    It pops up a box that it wants a new app to open this. (Windows 10 of course) clicking on the Excel.exe works fine.  CMD prompt works. What am I missing in PS?

    Thank you any smart people!

    CT

    • Merged by Bill_Stewart Friday, March 15, 2019 7:47 PM Duplicate
    Thursday, February 14, 2019 4:40 AM
  • You have a typo in your command.  There are extra characters in the command.

    Start-Process -"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"


    \_(ツ)_/

    Thursday, February 14, 2019 5:18 AM