Windows 10: Getting Powershell Return Code 2147942401

Discus and support Getting Powershell Return Code 2147942401 in Windows 10 Gaming to solve the problem; I'm trying to run a capture of devices in AAD that have not checked in for 90+ days then remove the corresponding AD devices. Using scripts deployed... Discussion in 'Windows 10 Gaming' started by Damon M, Dec 27, 2022.

  1. Damon M Win User

    Getting Powershell Return Code 2147942401


    I'm trying to run a capture of devices in AAD that have not checked in for 90+ days then remove the corresponding AD devices. Using scripts deployed through the Task Scheduler.The process is currently two separate scripts. The first script connects to AAD, searches for devices that have not checked in for 90+ days, and then writes the output to a file.The second script pulls the DeviceIDs from the file and uses them to remove matching devices from our local AD.Both of the scripts work when run manually using the -WhatIf parameter and dummy data. But when I load them into a scheduled task, the

    :)
     
    Damon M, Dec 27, 2022
    #1
  2. Sbanga Win User

    batch file from scheduled task returns code 2147942401

    I am trying to schedule a job to run a batch file with Windows 10 Task Scheduler, but it results in return code 2147942401.

    The batch file is on remote location so I am giving the absolute path
    "\\\server1\file transfers\data files\inbound\abc\csv\excel-to-csv.bat"


    Getting Powershell Return Code 2147942401 PRSQF.png



    Getting Powershell Return Code 2147942401 vcbZK.png


    If I run the batch script with command prompt then it work fine. Properties - General Actions - Edit Action

    The batch script is to convert excel to file to csv.

    Content of the script is:

    If i make changes in Action tab as mention by @Steinspecht(Task scheduler- task completed “successfully” with exit code 0x8007001) then also i am getting the code 2147942401
    Not sure whether Add a arguments is written correct
     
    Sbanga, Dec 27, 2022
    #2
  3. Kursah Win User
    PowerShell instead of Commandline in Creators Update

    Interestingly enough my personal laptop just got the update...and still has Command Prompt listed, not PowerShell...

    Edit: Not that it matters...I use both regularly. *Toast :toast:
     
    Kursah, Dec 27, 2022
    #3
  4. tjcreek55 Win User

    Getting Powershell Return Code 2147942401

    PowerShell does not launch bash.exe

    All,

    I
    am new and trying to learn.

    My
    issue: When I enter bash.exe in a PowerShell cmd window, my PC does not launch the Ubuntu command. I think Windows Subsystem for Linux (WSL) is not in my $ENVGetting Powershell Return Code 2147942401 :path.

    Troubleshooting
    I have done:

    1. Reading
      on the Internet, I can test my $ENVGetting Powershell Return Code 2147942401 :path by typing the following a PowerShell cmd:

    PS C:\WINDOWS\system32>
    where.exe calc

    C:\Windows\System32\calc.exe

    It returned the follow:

    PS C:\WINDOWS\system32>
    calc

    (And the calculator displayed
    on my PC)

    1. Reading
      on the Internet, I can also test my $ENVGetting Powershell Return Code 2147942401 :path by typing the following a PowerShell cmd:

    PS C:\WINDOWS\system32>
    where.exe wsl

    It returned the follow:

    INFO: Could not find
    files for the given pattern(s).

    Here
    is the output of $ENVGetting Powershell Return Code 2147942401 :path

    PS
    C:\WINDOWS\system32> $ENVGetting Powershell Return Code 2147942401 :path

    C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program
    Files (x86)\Calibre2\;C:\Program Files\PuTTY\;C:\Program Files\Microsoft VS Code\bin;C:\Users\user-lenovo595\AppData\Local\Microsoft\WindowsApps

    Question:

    What
    would you suggest as my next step to fix the issue?

    Thank
    you,
     
    tjcreek55, Dec 27, 2022
    #4
Thema:

Getting Powershell Return Code 2147942401

Loading...
  1. Getting Powershell Return Code 2147942401 - Similar Threads - Getting Powershell Return

  2. Powershell - object return

    in Windows 10 Customization
    Powershell - object return: Hello, I made a simple program that print specified computers in our Domain, sadly there is a problem with returning an object from a function after call. First call does not work, 2nd print same output 2 times. Do you have any idea how to display it in a first run? As far as...
  3. Powershell - object return

    in Windows 10 Gaming
    Powershell - object return: Hello, I made a simple program that print specified computers in our Domain, sadly there is a problem with returning an object from a function after call. First call does not work, 2nd print same output 2 times. Do you have any idea how to display it in a first run? As far as...
  4. Powershell - object return

    in Windows 10 Software and Apps
    Powershell - object return: Hello, I made a simple program that print specified computers in our Domain, sadly there is a problem with returning an object from a function after call. First call does not work, 2nd print same output 2 times. Do you have any idea how to display it in a first run? As far as...
  5. Getting Powershell Return Code 2147942401

    in Windows 10 Software and Apps
    Getting Powershell Return Code 2147942401: I'm trying to run a capture of devices in AAD that have not checked in for 90+ days then remove the corresponding AD devices. Using scripts deployed through the Task Scheduler.The process is currently two separate scripts. The first script connects to AAD, searches for...
  6. Not getting Code returned

    in Windows 10 Network and Sharing
    Not getting Code returned: When trying to enter Activity when already signed in I selected text to receive a code to verify Identity but no code is being sent??? Phone # is on account and entered correctly....
  7. Install Office 365 get 1603 return code

    in Windows 10 Installation and Upgrade
    Install Office 365 get 1603 return code: Hi Team, I am trying to install O365 once click the setp.exe, if you running the setup.exe it will appear few seconds from task manager. Wed, 19 Aug 2020 14:08:21 processing of package is complete, result -1917516221 0x8db50643 - code 1603...
  8. I get a bad return code on "Stop CryptSvc" task

    in Windows 10 Customization
    I get a bad return code on "Stop CryptSvc" task: Hi Shawn, [img] I am running a simple (2 lines) script called "Stop CryptSvc" saved in C:\ that starts on event 1074 and sometimes (1 out of 30) I get a bad return code, the task runs 2 sec too late (after apps delayed the task) or the task runs OK but the CryptSvc...
  9. I keep getting this error 4.0.30319 with a return code of 0xC00CE556

    in Windows 10 Customization
    I keep getting this error 4.0.30319 with a return code of 0xC00CE556: I don't really know it's like if I open a app it just shows me that error and the app immediately crashes https://answers.microsoft.com/en-us/windows/forum/all/i-keep-getting-this-error-4030319-with-a-return/45cf510b-30a1-45a1-8d19-009a4a84d6f7
  10. Why does Powershell return an error for Get-MpComputerStatus ?

    in Windows 10 Support
    Why does Powershell return an error for Get-MpComputerStatus ?: Instead it returns "Get-MpComputerStatus : The extrinsic Method could not be executed. at line:1 char:1 + Get-MpComputerStatus + ~~~~~~~~~~~~~~~~~~~~~~~~~ + Categorylnfo : MetadataError: (MSFT_HpComputerStatus:ROOT\Microsoft\...pComputerStatus) [Get-MpComputer Status],...