I am trying to use set-scsmobjecttemplate<br><br>$CMN11 = Get-SCSMObjectTemplate -DisplayName "CMN11 - Request for Results Notification"<br>$CRClassProjection = get-SCSMTypeProjection System.WorkItem.ChangeRequestProjection$<br>$CRP = Get-SCSMObjectProjection -Projection $CRClassProjection -Filter "Id -eq $CR_ID"<br>Set-SCSMObjectTemplate -Projection $CRP -Template $CMN11<br><br>PS C:\>>> Set-SCSMObjectTemplate -Projection $CRP -Template $CMN11<br>Set-SCSMObjectTemplate : The template cannot be applied to the instance because the instance is not of t<br>he template targets type.<br>At line:1 char:23<br>+ Set-SCSMObjectTemplate <<<< -Projection $CRP -Template $CMN11<br> + CategoryInfo : InvalidOperation: (Template_ae893e...2e7f27753abdbe3:ManagementPackObject<br> Template) [Set-SCSMObjectTemplate], InvalidOperationException<br> + FullyQualifiedErrorId : ApplyTemplate,SMLets.SetSCSMObjectTemplateCommand <br>And I think this is the cause, <br>PS C:\>>> $CRP = Get-SCSMObjectProjection -Projection $CRClassProjection -Filter "Id -eq $CR<br>_ID"<br>PS C:\>>> $CRP.GetType()<br><br>IsPublic IsSerial Name BaseType<br>-------- -------- ---- --------<br>True False PSCustomObject System.Object <br><br><br>PS C:\>>> $CRClassProjection.GetType()<br><br>IsPublic IsSerial Name BaseType<br>-------- -------- ---- --------<br>True False PSCustomObject System.Object<br><br>And according to the cmdlet help, we are looking for a specific type of object, <br>PS C:\>>> help Set-SCSMObjectTemplate<br><br>NAME<br> Set-SCSMObjectTemplate<br><br>SYNTAX<br> Set-SCSMObjectTemplate [-Projection] [-Name ] [-Tem<br> plate ] [-ComputerName ] [-Credential ] [-SCSMSe<br> ssion ] [-Verbose] [-Debug] [-ErrorAction ] [-WarningAc<br> tion ] [-ErrorVariable ] [-WarningVariable ] [-OutVariable ] [-OutBuffer ] [-WhatIf] [-Confirm]<br> Set-SCSMObjectTemplate [-Object] [-Name ] [-Template ] [-ComputerName ] [-Credential ] [-SCSMSession ] [-Verbose] [-Debug] [-ErrorAction ] [-WarningAction ] [-ErrorVariable ] [-WarningVariable ] [-OutVariable ] [-OutBuffer<br> ] [-WhatIf] [-Confirm]
Comments: ** Comment from web user: JFadmin **
Comments: ** Comment from web user: JFadmin **
I found that I was attempting to use this cmdlet incorrectly. I was trying to apply an email notification template.