# Send Message

## PowerShell Script

The following is the Send Message sample PowerShell script. Copy it and save it as a **.ps1** file. For further information on hosting this script see [Quick Guide to Self-Hosting Custom Scripts](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/custom-scripts-library/quick-guide-to-self-hosting-custom-scripts).&#x20;

```
msg.exe * $args[0]
```

## Custom Script Settings

The table below outlines all the fields that need to be set when creating this custom script.&#x20;

{% hint style="info" %}
For a detailed guide, refer to [Create a Send Message Custom Script](#create-a-send-message-custom-script).
{% endhint %}

| Field        | Value                                                                                                                   |
| ------------ | ----------------------------------------------------------------------------------------------------------------------- |
| Name         | **Send Message**                                                                                                        |
| URL          | <http://www.faronics.org/SendMessage.ps1>                                                                               |
| Type         | **PowerShell**                                                                                                          |
| Command-Line | Enter a message to display to the computer that it is being run on, e.g., **"This computer will reboot in 5 minutes."** |
| Run As       | **System Account** or **Specified User Account**                                                                        |

###

## Create a Send Message Custom Script

![Create a Custom Script](https://3007061244-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRkQfx_2cLnNNBX1muO%2F-MVTElzvvVzBy4ilZBk4%2F-MVTMQo7yXAzeNjC65UE%2Fimage.png?alt=media\&token=7a0a3ba4-1ce4-4768-af51-34d6956c7572)

1\. Select the **Control Grid** tab on the top menu bar.

2\. Navigate to the **Applications** tab.

3\. Click **CUSTOM** **SCRIPT**.

4\. Select **Create** **Custom** **Script**.

5\. Enter a **Name** for the script, **Send Message** in this example, use any name you'd like to use.

![Creating a Custom Script](https://3007061244-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRkQfx_2cLnNNBX1muO%2F-MWyqpdrtQLfG6CnzXMb%2F-MWyrMiG7a1M7A1Hd9R7%2Fimage.png?alt=media\&token=11b62a07-0e26-4c99-838d-315a0bea82f1)

6\. Enter the **URL** that points to the location where the script is being hosted,  <http://www.faronics.org/SendMessage.ps1> in this example. You might need to download this file and host it on a link that is whitelisted in your firewall.

{% hint style="info" %}
Best Practice is to download the sample script and self-host it. You can do this for free with GitHub. See the [Quick Guide to Self-Hosting Custom Scripts](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/custom-scripts-library/quick-guide-to-self-hosting-custom-scripts) for more information.
{% endhint %}

7\. Select the script type: **Powershell**.

8\. **Command Line**: Enter the message you’d like to send to the workstations enclosed in double-quotes, "**This computer will reboot in 5 minutes"** in this example.

9\. Select the account to **Run As**; either **System Accoun**t or **Specified User Account**.

10\. Click **SAVE TO GRID**.

{% hint style="info" %}
Once saved, the script can be pushed to an individual computer or groups of computers. It can also be scheduled using a Policy.

For a guide on how to run your Custom Script, see [Pushing the Script](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/..#pushing-the-script).
{% endhint %}

{% hint style="success" %}
The script will now appear in the list of Custom Scripts. It will also be available to select from the Applications Control Grid View.&#x20;

Search for the script in the grid using the search option. If your applications are grouped, you will see a column named **Custom** **Scripts**. Selecting the **Custom Script header** will display all the scripts that have been added to the grid.&#x20;
{% endhint %}

When the Send Message custom script is run, it will appear as a pop-up, as shown in the screenshot below:

![Message That Appears When Running the Custom Script](https://3007061244-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRkQfx_2cLnNNBX1muO%2F-MWyqpdrtQLfG6CnzXMb%2F-MWyrfJIfPHFSYHcBqVu%2Fimage.png?alt=media\&token=33655440-ae25-4a7d-9a98-061d420de35c)
