Samples | System PowerShell sample $dte = New-Object -COMObject "TcXaeShell.DTE.17.0" $dte.SuppressUI = $true # Route, target folder and project name separated by spaces in one string $dte.ExecuteCommand("File.OpenProjectFromTarget", "CX-123456 C:\Temp\Projects MyProject") The three parameters are passed as a single string, separated by spaces: 1. The route or NetID of the target system, for example, CX-123456 or 192.168.1.1.1.1 2. Local folder where the project should be saved. 3. Project name For the local system instead of a route: Use as the first parameter. For standalone PLC projects, there is an optional fourth parameter for the standalone project name.
6.3.17 How to manage routes | How to manage routes Routes can be added using ConsumeXml on the route node. It is not possible to delete items directly via the Automation Interface. An alternative is to edit StaticRoutes.xml directly. The project's target Net ID can be easily set and retrieved via ITcSysManager2 . Only unencrypted routes are created using this method; ADS Secure / encrypted routes are not supported . Requirements TwinCAT 3 is installed. To delete a route, you need write access to: C:\TwinCAT\3.1\TargetStaticRoutes.xml Adding a route using an IP address C#:
string xmlString = " true TargetList> RouteName 10.1.128.217.1.1 RemoteNetId> 10.1.128.217 Administrator 1 Password> "; ITcSmTreeItem routes = systemManager.LookupTreeItem("TIRR"); routes.ConsumeXml(xmlString); PowerShell: $xmlString =" Route Settings TIRR PathName> true TargetList> RouteName 10.1.128.217.1.1 RemoteNetId> 10.1.128.217 Administrator 1 Password> " $routes = $systemManager.LookupTreeItem("TIRR") $routes.ConsumeXml($xmlString) Adding a route using a hostname Route Settings TIRR true RouteName 1.2.3.4.5.6 CX-12345 userName password LocalName TE1000 220 Version: 1.7.0