Share via

How to execute System.Windows.Forms from the System Account using Task Scheduler

Anant Bera 271 Reputation points
2024-05-02T15:47:45.7766667+00:00

Hello Experts

We are working on the PowerShell to Pop out message forms to the user Accounts and we are using Add-Type -AssemblyName System.Windows.Forms to create the user interactive messages. We are currently using the SCCM to deploy the PowerShell script across all of the user's computers. But somehow how it is not running and the script is running as a System account.

We have tried to run the PowerShell script using the Task scheduler as well from the system account and we got the error log due to which is it not running from the task scheduler

Below is the error message we are getting

Exception calling "Show" with "4" argument(s): "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application."

What steps we would need to configure so that we won't get these message?????

The pop message is important for us also we will run the script from System account

Thanks in advance

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 83,741 Reputation points
    2024-05-02T15:55:34.5933333+00:00

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.