# Step 1: get the XML of the file you want to modify [xml]$APPL_XML = Get-Content "path-to-xml-file" # Step 2: create the xml node for the WOB you want to add $WOB = $APPL_XML.CreateNode("element","app:nt_job","http://dto.wa.ca.com/application") $WOB.setAttribute("name","JOB01") # Step 3: create the xml nodes that that translate to the fields on the WOB $dependencies = $APPL_XML.CreateNode("element","app:dependencies","http://dto.wa.ca.com/application") $notifynodefaults = $APPL_XML.CreateNode("element","app:notifynodefaults","http://dto.wa.ca.com/application") $notifynodefaults.InnerText = "true" $alert_notifynodefaults = $APPL_XML.CreateNode("element","app:alert_notifynodefaults","http://dto.wa.ca.com/application") $alert_notifynodefaults.InnerText = "false" $snmp_notifynodefaults = $APPL_XML.CreateNode("element","app:snmp_notifynodefaults","http://dto.wa.ca.com/application") $snmp_notifynodefaults.InnerText = "false" $hold = $APPL_XML.CreateNode("element","app:hold","http://dto.wa.ca.com/application") $hold.InnerText = "false" $request = $APPL_XML.CreateNode("element","app:conditional","http://dto.wa.ca.com/application") $request.InnerText = "false" $conditional = $APPL_XML.CreateNode("element","app:notifynodefaults","http://dto.wa.ca.com/application") $conditional.InnerText = "false" $criticaljob = $APPL_XML.CreateNode("element","app:criticaljob","http://dto.wa.ca.com/application") $criticaljob.InnerText = "false" $job_ancestor_wait_default_ignore = $APPL_XML.CreateNode("element","app:job_ancestor_wait_default_ignore","http://dto.wa.ca.com/application") $job_ancestor_wait_default_ignore.InnerText = "true" $retry = $APPL_XML.CreateNode("element","app:retry","http://dto.wa.ca.com/application") $subappl_wait = $APPL_XML.CreateNode("element","app:subappl_wait","http://dto.wa.ca.com/application") $subappl_wait.InnerText = "false" $agent = $APPL_XML.CreateNode("element","app:agent","http://dto.wa.ca.com/application") $agent.InnerText = "SERVER_100" $userid = $APPL_XML.CreateNode("element","app:userid","http://dto.wa.ca.com/application") $userid.InnerText = "DOMAIN\USERID" $args = $APPL_XML.CreateNode("element","app:args","http://dto.wa.ca.com/application") $args.InnerText = "-command 'D:\Cyb_exec\job01.ps1" $cmdname = $APPL_XML.CreateNode("element","app:cmdname","http://dto.wa.ca.com/application") $cmdname.InnerText = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" $is_interactive_job = $APPL_XML.CreateNode("element","app:is_interactive_job","http://dto.wa.ca.com/application") $is_interactive_job.InnerText = "false" # Step 4: make the nodes created in step 3 children of the node created in step 2 $WOB.AppendChild($dependencies) $WOB.AppendChild($notifynodefaults) $WOB.AppendChild($alert_notifynodefaults) $WOB.AppendChild($snmp_notifynodefaults) $WOB.AppendChild($hold) $WOB.AppendChild($request) $WOB.AppendChild($conditional) $WOB.AppendChild($criticaljob) $WOB.AppendChild($job_ancestor_wait_default_ignore) $WOB.AppendChild($retry) $WOB.AppendChild($subappl_wait) $WOB.AppendChild($agent) $WOB.AppendChild($userid) $WOB.AppendChild($args) $WOB.AppendChild($cmdname) $WOB.AppendChild($is_interactive_job) # Step 5: Add the newly minted $WOB node to as the $APPL_XML.appl.AppendChild($WOB) # Step 6: Save the xml file, ready to be imported back into DE $APPL_XML.Save('enter-path-here')