@@ -4,7 +4,7 @@ function New-CitrixTemplateGroup {
44 Creates a new Group in the Citrix Optimizer template.
55
66 . DESCRIPTION
7- This function will create a Group in the Citrix Optimizer template. First it will check if that group exists, if not it will add it.
7+ This function will create a Group in the Citrix Optimizer template. First it will check if that < group> exists, if not it will add it.
88
99 . PARAMETER Path
1010 Specifies the Path to the template file
@@ -62,6 +62,7 @@ begin {
6262
6363process {
6464
65+ # Check if the template already exists
6566 if (Get-Template - Path $Path ){
6667
6768 write-verbose " Citrix Optimizer Template $ ( $Path ) found"
@@ -70,44 +71,53 @@ process {
7071 # Load Template and check for existing Group"
7172 [XML ]$xmlfile = Get-Content $Path
7273
74+ # Check that the template group does not exist
7375 if (! (Get-TemplateGroup - Path $Path - GroupName $GroupName )){
7476
7577 write-verbose " No existing Groups found, adding new group"
7678
79+ # Create the Group element
7780 write-verbose " Create Group element"
7881 $Group = $XMLFile.CreateElement (" group" )
7982
83+ # Create the ID element
8084 write-verbose " Create ID element"
8185 $ID = $XMLFile.CreateElement (" id" )
8286 $ID.InnerText = $GroupName
8387 $Group.AppendChild ($ID )
8488
89+ # Create the display name element
8590 write-verbose " Create DisplayName element"
8691 $Name = $XMLFile.CreateElement (" displayname" )
8792 $Name.InnerText = $GroupName
8893 $Group.AppendChild ($Name )
8994
95+ # Create the description element
9096 write-verbose " Create Description element"
9197 $Description = $XMLFile.CreateElement (" description" )
9298 $Description.InnerText = $GroupDescription
9399 $Group.AppendChild ($Description )
94100
101+ # Append the group ID element to the Group and save the XML file
95102 write-verbose " Add Group to Citrix Optimizer XML Template"
96103 $XMLFile.LastChild.AppendChild ($Group )
97104 $XMLFile.Save ($Path )
98105
106+ # Add the GroupName to the return object
99107 $Return | Add-Member - MemberType NoteProperty - Name " GroupName" - Value $GroupName
100108 $Return.Complete = $true
101109
102110 } else {
103-
111+
112+ # Group already exists
104113 write-verbose " Group $ ( $GroupName ) already exists - quitting"
105114 write-error " Group $ ( $GroupName ) already exists - quitting"
106115
107116 }
108117
109118 } else {
110119
120+ # Template file not found
111121 write-verbose " Citrix Optimizer Template $ ( $Path ) not found - quitting"
112122 write-error " Citrix Optimizer Template $ ( $Path ) not found - quitting"
113123
@@ -117,6 +127,7 @@ process {
117127
118128end {
119129
130+ # Pass back return object
120131 return $Return
121132
122133} # end
0 commit comments