private void InitNewScript(List <ScriptDto> listScript) { String newId = StringUtils.RandomString(16); XmlFile xmlF = appArgs.XmlFile; XmlAttribute idAttribute = xmlF.Doc.CreateAttribute("id"); idAttribute.Value = newId; XmlElement script = xmlF.CreateXmlElement("script"); script.Attributes.Append(idAttribute); xmlF.CreateSetValueAndAppendTo("path", "mandatory", script); xmlF.CreateSetValueAndAppendTo("wd", "optionnal", script); xmlF.CreateSetValueAndAppendTo("args", "optionnal", script); XmlElement psParamsXml = xmlF.CreateAndAppendTo("powershellParams", script); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.NoExit)), "true|false", psParamsXml); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.NoLogo)), "true|false", psParamsXml); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.NoProfile)), "true|false", psParamsXml); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.WindowStyle)), "Normal|Hidden|Minimized|Maximized", psParamsXml); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.WaitSeconds)), "lt0:infinite", psParamsXml); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.WithAdmin)), "true|false", psParamsXml); xmlF.CreateSetValueAndAppendTo(AppReflexionUtils.GetXmlName(nameof(PowershellParams.OutputToFile)), "No|NoIfNothing|Yes", psParamsXml); XmlComment scriptComment = xmlF.Doc.CreateComment(XmlUtils.FormatXmlString(script.OuterXml)); xmlF.Root.AppendChild(scriptComment); xmlF.Save(); FileUtils.ShowFileInWindowsExplorer(xmlF.FileXmlPath); }