PowerShell script pinned to taskbar has stopped working


  1. Posts : 275
    Windows 10
       #1

    PowerShell script pinned to taskbar has stopped working


    I made a very simple PowerShell script to open my display settings so that I could quickly change the display scale, which I pinned to my taskbar. It worked fine until today, when it stopped working from the taskbar, although it still works if I right-click on the script in explorer and run it that way. I have no idea why it suddenly stopped working from the taskbar. I unpinned it from the taskbar and then pinned it again (by first pinning the powershell exe), but when I try to run it now it displays some kind of error message in red. Unfortunately the powershell window closes before I can read the error message. How can I regain quick access to my display settings?
      My Computer


  2. Posts : 3,277
    Win10
       #2

    You can try and insert a temporary sleep command in your pinned script to pause the window before it closes, so you can see the error message.
    eg:

    Start-Sleep -Seconds 10

    https://docs.microsoft.com/en-us/pow...w=powershell-6
      My Computers


  3. Posts : 16,970
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #3

    now it displays some kind of error message in red. Unfortunately the powershell window closes before I can read the error message
    Write Pause on a last line of the script and it will stay open until you press Return.

    Denis
      My Computer


  4. Posts : 275
    Windows 10
    Thread Starter
       #4

    Thanks both of you for your suggestions. Unfortunately neither of them stop the window from closing almost as soon as it opens.
      My Computer


  5. Posts : 870
    Windows 10 Professional x64 21H2
       #5

    Some options here for that.
    How do you do a ‘Pause’ with PowerShell
      My Computers


  6. Posts : 275
    Windows 10
    Thread Starter
       #6

    I've found the solution. Trying to run the script in the Powershell ISE showed me the error message long enough for me to read it. Running scripts had been disabled, possibly during the upgrade to version 1903. Running PowerShell as administrator and entering "set-executionpolicy remotesigned" re-enabled running scripts.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 19:06.
Find Us




Windows 10 Forums