File tree Expand file tree Collapse file tree
CitrixOptimizerAutomation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# bretty.me.uk Defined
22
3- # Local Testing for XML File Generation
3+ # Local Testing for XML File Generation and Local PS1 File Testing
44* .xml
5+ * .ps1
56
67# VSCode
78
Original file line number Diff line number Diff line change @@ -41,17 +41,25 @@ begin {
4141process {
4242
4343 # Trim any Trailing \ chatacters
44- $TaskTrimmed = $TaskPath.Substring (0 , $TaskPath.Length - 1 )
44+ if ($TaskPath -notmatch ' \\$' ){
45+ $TaskTrimmed = $TaskPath.Substring (0 , $TaskPath.Length )
46+ } else {
47+ $TaskTrimmed = $TaskPath.Substring (0 , $TaskPath.Length - 1 )
48+ }
4549
50+ if (! ($TaskTrimmed.StartsWith (" \" ))){
51+ $TaskTrimmed = " \$ ( $TaskTrimmed ) "
52+ }
53+
4654 # Get The Task Name
4755 $TaskName = $TaskTrimmed.Substring ($TaskTrimmed.lastIndexOf (' \' ) + 1 )
4856
4957 # Get The Task Path
50- $TaskPath = $TaskTrimmed.Substring (0 , $TaskTrimmed.lastIndexOf (' \' ) + 1 )
58+ $TaskPathReturn = $TaskTrimmed.Substring (0 , $TaskTrimmed.lastIndexOf (' \' ) + 1 )
5159
5260 # Build the Return Object
5361 $Return | Add-Member - MemberType NoteProperty - Name " TaskName" - Value $TaskName
54- $Return | Add-Member - MemberType NoteProperty - Name " TaskPath" - Value $TaskPath
62+ $Return | Add-Member - MemberType NoteProperty - Name " TaskPath" - Value $TaskPathReturn
5563
5664} # process
5765
Original file line number Diff line number Diff line change @@ -47,12 +47,12 @@ process {
4747 }
4848
4949 # Add the true return value
50- $FormattedScript = $FormattedScript + " `t`t " + ' $Global' + " :CTXOE_Details = " + " Complete;`n "
50+ $FormattedScript = $FormattedScript + " `t`t " + ' $Global' + " :CTXOE_Details = " + " "" Complete"" ;`n "
5151 $FormattedScript = $FormattedScript + " `t`t " + ' $Global' + " :CTXOE_Result = " + ' $True;' + " `n "
5252 $FormattedScript = $FormattedScript + " `t } catch {`n "
5353
5454 # Add the false return value
55- $FormattedScript = $FormattedScript + " `t`t " + ' $Global' + " :CTXOE_Details = " + " Errored;`n "
55+ $FormattedScript = $FormattedScript + " `t`t " + ' $Global' + " :CTXOE_Details = " + " "" Errored"" ;`n "
5656 $FormattedScript = $FormattedScript + " `t`t " + ' $Global' + " :CTXOE_Result = " + ' $False;' + " `n "
5757 $FormattedScript = $FormattedScript + " `t }`n "
5858
Original file line number Diff line number Diff line change @@ -142,7 +142,6 @@ process {
142142
143143 # Write the PowerShell Formatted Script
144144 $ParamValue = $XMLFile.CreateElement (" value" )
145- $ParamValue.InnerText = $FinalScript
146145 $ParamValue.AppendChild ($XMLFile.CreateCDataSection ($FinalScript ))
147146 $Params.AppendChild ($ParamValue )
148147
You can’t perform that action at this time.
0 commit comments