# New-RASNotificationScript

## NAME

New-RASNotificationScript

## SYNOPSIS

Creates new notification script.

## SYNTAX

**New-RASNotificationScript**\
-[Command](#command-string) _(string)_\
-[Name](#name-string) _(string)_\
\[[Arguments](#arguments-string) _(string)_]\
\[[InitialDirectory](#initialdirectory-string)_(string)_] \[[Password](#password-string)_(SecureString)_] \[[SiteId](#siteid-string)_(uint)_] \[[Username](#username-string)_(string)_]\
\[_(_[_CommonParameters_](#CommonParameters)_)_]

**New-RASNotificationScript**\
-[Password](#password-string) _(SecureString)_\
-[Username](#username-string) _(string)_\
\[_(_[_CommonParameters_](#CommonParameters)_)_]

## DESCRIPTION

A script can be attached to any of the notifications.

## PARAMETERS

## Name (string)

Script name.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## SiteId (uint)

Site ID

If the parameter is omitted, the site ID of the Licensing Server will be\
used.

```
        Required?                    false

        Position?                    named

        Default value                0

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Command (string)

Command to execute when invoked.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Arguments (string)

Command arguments.

Possible values: ($CA), ($ENROLLMENTMETHOD), ($FARM-NAME),\
($HOSTPOOL), ($LOCATION), ($NOTIFICATION-TIME),\
($NOTIFICATION-TYPE), ($PROVIDER), ($RESOURCEGROUP),\
($SERVER-ADDRESS), ($SITE-NAME), ($TENANTBROKER), ($TENANTNAME),\
($THRESHOLD-DIRECTION), ($THRESHOLD-VALUE), ($TRIGGER-ADDRESS),\
($WORKSPACE)

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## InitialDirectory (string)

Script base directory

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Username (string)

Execute script as this system user.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## Password (SecureString)

System user password.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

(CommonParameters)

```
        This cmdlet supports the common parameters: Verbose, Debug,

        ErrorAction, ErrorVariable, WarningAction, WarningVariable,

        OutBuffer, PipelineVariable, and OutVariable. For more information, see 

        about_CommonParameters documentation. 
```

## INPUTS

-none-

## OUTPUTS

[NotificationScript](../types/notificationscript)

## EXAMPLES

\*\*---------- EXAMPLE 1 ----------

New-RASNotificationScript -Name "scriptName" -Command "myscript.py"\
-Arguments "(\`$HOSTPOOL) (\`$CA)" -InitialDirectory "C:\ -Username\
"Administrator"

Creates a new notification script which runs as 'Administrator' user.

When 'Username' parameter is specified a password will be prompted.\
\*\*---------- EXAMPLE 2 ----------

New-RASNotificationScript -Name "scriptName" -Command "myscript.py"\
-Arguments "(\`$HOSTPOOL) (\`$CA)" -InitialDirectory "C:\ -Username\
"Administrator" -Password (ConvertTo-SecureString -String "abc"\
-AsPlainText -Force)

Creates a new notification script which runs as 'Administrator' user.

## RELATED LINKS

* [Get-RASNotificationScript](get-rasnotificationscript)
* [Set-RASNotificationScript](set-rasnotificationscript)
* [Remove-RASNotificationScript](remove-rasnotificationscript)
