Windows 10: Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script...

Discus and support Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script... in Windows 10 Installation and Upgrade to solve the problem; Here is the content of PowerShell script I am trying to run via a startup or log on task created via Task Scheduler in Windows 10. #power shell file... Discussion in 'Windows 10 Installation and Upgrade' started by Rabi Cherian, Feb 7, 2019.

  1. Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script...


    Here is the content of PowerShell script I am trying to run via a startup or log on task created via Task Scheduler in Windows 10.


    #power shell file saved as autostartsshd.ps1

    bash -c 'sudo service ssh start'


    This runs fine when run with powershell.

    But running from Task Scheduler at log on throws this error:

    bash : The term 'bash' is not recognized as the name of a cmdlet, function, script file, or operable program. Check

    the spelling of the name, or if a path was included, verify that the path is correct and try again.

    At D:\ssh_startup\autostartsshd.ps1:2 char:1

    + bash -c 'sudo service ssh start'

    + ~~~~

    + CategoryInfo : ObjectNotFound: (bash:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException


    WorkAround: Create a symlink to 32bit bash.exe in SysWOW64

    PS C:\Windows\system32> cd ..\SysWOW64\

    PS C:\Windows\SysWOW64> New-Item -ItemType SymbolicLink -Name bash.exe -Target c:\Windows\System32\bash.exe


    Can this community help file a bug on this issue, so that it can be fixed in future?

    :)
     
    Rabi Cherian, Feb 7, 2019
    #1
  2. dalchina Win User
    dalchina, Feb 7, 2019
    #2
  3. Peer_Sam Win User
    Task Scheduler doesn't run script

    Hi,

    Thank you for writing to Microsoft Community Forums.

    Are you able to run the script manually? If yes, does it do what it is intended to?

    Disable the UAC temporarily.

    Make sure that the Task scheduler
    service is running.

    Press ‘Win+R’.

    Type Services.msc.

    Locate the service Task scheduler
    and make sure that it is in running state.

    Go to the Conditions
    tab in task scheduler and make sure that no such condition is set which could block the task from running.

    Enable All Tasks History in Task scheduler and run the scheduled task.

    Refresh the task scheduler and check if you find any error message/code for any step in the task run.

    Also try with disabling Run whether the user is logged on or not
    option and see if the script runs.

    Hope it helps.

    Peer Samie

    Microsoft Community-Moderator
     
    Peer_Sam, Feb 7, 2019
    #3
  4. Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script...

    Window's Task Scheduler Not Running

    Hi,

    To assist you better, kindly provide us more details by answering the following questions:

    • Have you tried recreating the task? If so, are you getting the same issue?
    • Have you tried creating a new task?
    Meanwhile, we suggest that you ensure that the Task Scheduler is running. You can verify if the service is running by following these steps:

    • Press Windows key + R on your keyboard.
    • Type services.msc and hit Enter.
    • Under Services (Local), make sure that the Task Scheduler service's status is
      Started or Enabled.
    Should you need further assistance, feel free to get back to us.
     
    Monica Cam, Feb 7, 2019
    #4
Thema:

Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script...

Loading...
  1. Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script... - Similar Threads - Window WSL Task

  2. Problem getting a powershell script to run in Task Scheduler

    in Windows 10 Software and Apps
    Problem getting a powershell script to run in Task Scheduler: Hello. I am trying to get a PowerShell script to run once every half hour in the Task Scheduler utility. The platform is Windows Server 2019 Standard Edition. I configured the script to run on a schedule starting at 12:00 AM every day, and repeat every 30 minutes...
  3. Problem getting a powershell script to run in Task Scheduler

    in Windows 10 Gaming
    Problem getting a powershell script to run in Task Scheduler: Hello. I am trying to get a PowerShell script to run once every half hour in the Task Scheduler utility. The platform is Windows Server 2019 Standard Edition. I configured the script to run on a schedule starting at 12:00 AM every day, and repeat every 30 minutes...
  4. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Gaming
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  5. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Software and Apps
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  6. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Network and Sharing
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  7. Powershell script does not run via Task Scheduler

    in Windows 10 Customization
    Powershell script does not run via Task Scheduler: PowerShell script runs fine manually, but doesn't run in Task scheduler. The script: [ATTACH] I tried another command$env:COMPUTERNAME and works fine both manually and via PowerShell....
  8. PowerShell script does not run as Scheduled Task – 0xFFFD0000 error

    in Windows 10 News
    PowerShell script does not run as Scheduled Task – 0xFFFD0000 error: [ATTACH] [ATTACH]The Windows 10 Task Scheduler is a boon for a group of users who like to schedule different tasks and automate them. I use it all the time to schedule periodic execution of scripts and some programs to ensure my [...] This post PowerShell script does not run...
  9. Task Scheduler doesn't run script

    in Windows 10 Software and Apps
    Task Scheduler doesn't run script: Hey Microsoft Community, I'm trying to create a task in Task Scheduler that runs a specific script. The issue is that when the task runs (whether I do it manually or if it's scheduled), the script doesn't actually get executed. I know that the script works, and I have tried...
  10. Problem Getting a Powershell Script to Run in Task Scheduler

    in Windows 10 Software and Apps
    Problem Getting a Powershell Script to Run in Task Scheduler: Hope I'm in the right place! I am trying to get a Powershell script to run daily in the task scheduler. It basically purges a folder on one of my drives: Get-ChildItem –Path “D:\Dropbox\Quicken\Backup” –Recurse | Where-Object CreationTime –lt (Get-Date).AddDays(-10) |...

Users found this page by searching for:

  1. start wsl at windows logon

    ,
  2. windows10 run wsl task

    ,
  3. windows 10 powershell 2019 crashing

    ,
  4. wsl task scheduler