Share via

How do I fix this?

Robert Christensen 0 Reputation points
2026-03-11T18:03:33.4333333+00:00

Script exited with code 1: C:\Users\ricke\AppData\Local\Temp\smsgateway_send_f001a63d676c424b94365fee722eade1.ps1 : Send button not enabled + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,smsgateway_send_f001a63d676c424b94365f ee722eade1.ps1

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Scott Nguyen 150 Reputation points Independent Advisor
    2026-03-11T19:12:31.82+00:00

    Hi Robert Christensen,

    Thanks for giving your problem to us.

    The exit code 1 indicates a generic failure. The Write-Error cmdlet was explicitly called by the script author to halt execution because the UI element or API state required for the "Send" operation was inactive. Since the script is located in AppData\Local\Temp, it is likely a transient script generated by a third-party application or a monitoring agent.

    To resolve this issue, try to follow these troubleshooting steps:

    1. Validate Input Data

    Ensure that the data being passed to the script is complete. A "Send" button remains disabled in most gateway interfaces if:

    • The Destination Number is missing or improperly formatted (e.g., missing country code).
    • The Message Body exceeds character limits or is empty.
    • The API Credentials or Session Token has expired.
    1. Address Timing and Race Conditions

    If this script utilizes UI Automation (e.g., Selenium or WinAppDriver), the script may be attempting to click the button before the application has fully initialized.

    Solution: Implement a "Wait" logic to ensure the element is Enabled before the interaction occurs.

    1. Inspect the Originating Application

    Since the script is generated in the Temp folder, the root cause usually lies in the configuration of the parent software.

    Check the logs of the service that triggered smsgateway_send_*.ps1.

    Ensure the service account running the script has the appropriate permissions to interact with the network or the gateway UI.

    For further technical deep-dives into handling these types of PowerShell exceptions, you can refer to some of the following Microsoft resources:

    Handling Script Errors: About Throw | Microsoft Learn
    PowerShell Error Action Preference: About CommonParameters | Microsoft Learn
    Windows UI Automation Overview: UI Automation Support for Standard Controls

    If you find the answer useful, please mark it as the "Accepted Answer" so other members can find the solution easily. Your help in supporting the community is much appreciated!

    Best regards,
    Scott Nguyen

    0 comments No comments

  2. Q&A Assist
    2026-03-11T18:03:46.52+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message shows that the PowerShell script smsgateway_send_*.ps1 is calling Write-Error with the message Send button not enabled, and that error is causing the script to exit with code 1. In other words, the script itself is deliberately failing because some internal condition (a “Send” button not being enabled) is not met.

    From the PowerShell side, this is just a terminating error raised by Write-Error. PowerShell treats this as an exception that stops the script and returns a non‑zero exit code. The fix therefore is not in PowerShell itself, but in whatever logic inside smsgateway_send_*.ps1 decides to call Write-Error.

    To resolve it, the script or the application that generates this script must be corrected so that:

    1. The “Send” button is enabled before the script runs, or
    2. The script’s condition that checks the button state is updated so it does not call Write-Error in normal scenarios, or
    3. The caller handles the error (for example, by wrapping the call in try { … } catch { … }) and reacts appropriately instead of treating it as a fatal failure.

    If the script is custom, inspect it for a Write-Error statement that uses the message Send button not enabled and adjust the logic so that it only throws an error when there is a genuine fault. If the script is generated by third‑party software, that software’s configuration or workflow must be fixed so that the “Send” action is valid when the script runs.

    The PowerShell engine and exception behavior (terminating errors, Write-Error, and exit codes) are working as designed; the root cause is the script’s own error condition.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.