# Invoke-RASTemplate

### NAME

Invoke-RASTemplate\ <br>

### SYNOPSIS

Perform RAS Template commands.\ <br>

### SYNTAX

Invoke-RASTemplate \[-[Id](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#Id)] *\<uint>* -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#Command) {EnterMaintenance | ExitMaintenance | RecreateHosts | RecreateDesktops} -[ObjType](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#ObjType) {RDSTemplate | VDITemplate | AVDTemplate} \[-[CreateTemplateVersion](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#CreateTemplateVersion) *\<SwitchParameter>*] \[-[ForceStopUpdateHosts](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#ForceStopUpdateHosts) *\<SwitchParameter>*] \[-[RecreateAllHosts](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#RecreateAllHosts) *\<SwitchParameter>*] \[-[TemplateVersionId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#TemplateVersionId) *\<uint>*] \[-[VDIHostId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#VDIHostId) *\<string>*] \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#CommonParameters)*>*]\
\
Invoke-RASTemplate \[-[InputObject](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#InputObject)] *<*[*Template*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/Template.html)*>* -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#Command) {EnterMaintenance | ExitMaintenance | RecreateHosts | RecreateDesktops} -[ObjType](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#ObjType) {RDSTemplate | VDITemplate | AVDTemplate} \[-[CreateTemplateVersion](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#CreateTemplateVersion) *\<SwitchParameter>*] \[-[ForceStopUpdateHosts](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#ForceStopUpdateHosts) *\<SwitchParameter>*] \[-[RecreateAllHosts](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#RecreateAllHosts) *\<SwitchParameter>*] \[-[TemplateVersionId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#TemplateVersionId) *\<uint>*] \[-[VDIHostId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#VDIHostId) *\<string>*] \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#CommonParameters)*>*]\
\
Invoke-RASTemplate \[-[Name](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#Name)] *\<string>* \[\[-[SiteId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#SiteId)] *\<uint>*] -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#Command) {EnterMaintenance | ExitMaintenance | RecreateHosts | RecreateDesktops} -[ObjType](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#ObjType) {RDSTemplate | VDITemplate | AVDTemplate} \[-[CreateTemplateVersion](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#CreateTemplateVersion) *\<SwitchParameter>*] \[-[ForceStopUpdateHosts](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#ForceStopUpdateHosts) *\<SwitchParameter>*] \[-[RecreateAllHosts](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#RecreateAllHosts) *\<SwitchParameter>*] \[-[TemplateVersionId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#TemplateVersionId) *\<uint>*] \[-[VDIHostId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#VDIHostId) *\<string>*] \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASTemplate.html#CommonParameters)*>*]\ <br>

### DESCRIPTION

Triggers an action on the selected Template such as: EnterMaintenance, ExitMaintenance or RecreateHosts.\
\
EnterMaintenance: Toggle the template into maintenance mode.\
\
ExitMaintenance: Toggle the template out from maintenance mode.\
\
RecreateHosts: Re-creates one or all of the Template hosts.\ <br>

### PARAMETERS

\
-**Name \<string>**\
The name of the target RAS Template.\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**SiteId \<uint>**\
Site ID of the specified RAS Template.\
\
If the parameter is omitted, the site ID of the Licensing Server will be used.\ <br>

```
        Required?                    false
```

```
        Position?                    1
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**Id \<uint>**\
The ID of the target RAS Template.\
\
To obtain the ID, use the Get-RASTemplate cmdlet.\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**InputObject <**[**Template**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/Template.html)**>**\
An object of type Template which represents a RAS Template.\
\
To obtain the object, use the Get-RASTemplate cmdlet.\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                
```

```
        Accept pipeline input?       true (ByValue)
```

```
        Accept wildcard characters?  false
```

\
-**ObjType <**[**Template**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/Template.html)**>**\
Template object type.\
\
Possible values: RDSTemplate, VDITemplate, AVDTemplate\ <br>

```
        Required?                    true
```

```
        Position?                    named
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**Command <**[**Template**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/Template.html)**>**\
Template command.\
\
Accepted values: EnterMaintenance, ExitMaintenance, RecreateHosts.\
\
Possible values: EnterMaintenance, ExitMaintenance, RecreateHosts, RecreateDesktops\ <br>

```
        Required?                    true
```

```
        Position?                    named
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**ForceStopUpdateHosts \<SwitchParameter>**\
Specifies whether to force stopping/updating of hosts.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                False
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**VDIHostId \<string>**\
The ID of a host VM to be recreated.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**RecreateAllHosts \<SwitchParameter>**\
Specifies whether to re-create all hosts for the specified template.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                False
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**TemplateVersionId \<uint>**\
The template version ID from which new hosts will be (re-)created from. Default: null.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**CreateTemplateVersion \<SwitchParameter>**\
Switch determining whether or not a new template version is created on ExitMaintenance. Default: false.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                False
```

```
        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 . 
```

<br>

### INPUTS

[Template](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/Template.html)

### OUTPUTS

-none-

### EXAMPLES

\
\&#xNAN;**---------- EXAMPLE 1 ----------**\
\
Invoke-RASTemplate "TemplateName" -ObjType RDSTemplate -Command EnterMaintenance\
\
Switch the RAS Template specified by name to maintenance mode in the Licensing Server site.\
\
Since -ForceStopUpdateHosts is not included, hosts will not be stopped/updated.\
\&#xNAN;**---------- EXAMPLE 2 ----------**\
\
Invoke-RASTemplate -ObjType VDITemplate -Id 10 -Command ExitMaintenance -ForceStopUpdateHosts\
\
Switch the RAS Template specified by ID from the maintenance mode.\
\
Since -ForceStopUpdateHosts is included, hosts will be stopped/updated, if required.\
\&#xNAN;**---------- EXAMPLE 3 ----------**\
\
Invoke-RASTemplate "TemplateName" -ObjType RDSTemplate -Command RecreateHosts -VDIHostId 42312685-05c9-ca51-342d-b3943046edf1\
\
Re-create the specified host of the RAS Template specified by name in the Licensing Server site.\
\
Since -RecreateAllHosts is not included, only the specified host will be re-created.\
\&#xNAN;**---------- EXAMPLE 4 ----------**\
\
Invoke-RASTemplate -ObjType RDSTemplate -InputObject $Template -Command RecreateHosts -RecreateAllHosts\
\
Re-create all hosts of the RAS Template specified by the $Template object.\
\&#xNAN;**---------- EXAMPLE 5 ----------**\
\
Get-RASTemplate -ObjType VDITemplate -Id 10 | Invoke-RASTemplateCmd -Command RecreateHosts -RecreateAllHosts\
\
Re-create all hosts of the RAS Template specified by an object obtained from the pipeline output.
