Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

[NEW-FEATURE] Make it work with 4026 #745

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pipelines/utils/CleanupTargetBoot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ $Session = New-TcSession -NetId $TargetAmsId -Port 10000
#-------------------------------------------
Write-Host "Cleaning up the target's boot directory"

$FileHandle = Send-TcReadWrite -IndexGroup 0x78 -IndexOffset 0x10002 -ReadType UInt32 -ReadLength 4 -WriteValue "C:\Twincat\3.1\Boot\PlcCleanup.bat" -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore

$FileHandle = Send-TcReadWrite -IndexGroup 0x78 -IndexOffset 0x10002 -ReadType UInt32 -ReadLength 4 -WriteValue "C:\ProgramData\Beckhoff\Twincat\3.1\Boot\PlcCleanup.bat" -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore
#C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot\Plc
#Write commands into the cleanup file
$CmdList = New-Object Collections.Generic.List[String]
$CmdList.Add("rmdir /q /s C:\Twincat\3.1\Boot\CurrentConfig")
$CmdList.Add("rmdir /q /s C:\Twincat\3.1\Boot\Plc")
$CmdList.Add("mkdir C:\Twincat\3.1\Boot\Plc")
$CmdList.Add("del C:\Twincat\3.1\Boot\*.* /F /Q")
$CmdList.Add("rmdir /q /s C:\ProgramData\Beckhoff\Twincat\3.1\Boot\CurrentConfig")
$CmdList.Add("rmdir /q /s C:\ProgramData\Beckhoff\Twincat\3.1\Boot\Plc")
$CmdList.Add("mkdir C:\ProgramData\Beckhoff\Twincat\3.1\Boot\Plc")
$CmdList.Add("del C:\ProgramData\Beckhoff\Twincat\3.1\Boot\*.* /F /Q")


try {
Expand All @@ -49,8 +49,8 @@ finally {

# Prepare data for starting remote process on target
$Enc = [system.Text.Encoding]::UTF8
$Process = $Enc.GetBytes("C:\TwinCAT\3.1\Boot\PlcCleanup.bat")
$Path = $Enc.GetBytes("C:\TwinCAT\3.1\Boot")
$Process = $Enc.GetBytes("C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot\PlcCleanup.bat")
$Path = $Enc.GetBytes("C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot")
$Data = new-object byte[] 780
$Data[0] = 0x22
$Data[4] = 0x13
Expand Down
18 changes: 9 additions & 9 deletions pipelines/utils/Load-XaeProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ $Session = New-TcSession -NetId $TargetAmsId -Port 10000
#-------------------------------------------
Write-Host "Cleaning up the target's boot directory"

$FileHandle = Send-TcReadWrite -IndexGroup 0x78 -IndexOffset 0x10002 -ReadType UInt32 -ReadLength 4 -WriteValue "C:\Twincat\3.1\Boot\PlcCleanup.bat" -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore
$FileHandle = Send-TcReadWrite -IndexGroup 0x78 -IndexOffset 0x10002 -ReadType UInt32 -ReadLength 4 -WriteValue "C:\ProgramData\Beckhoff\Twincat\3.1\Boot\PlcCleanup.bat" -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore

#Write commands into the cleanup file
$CmdList = New-Object Collections.Generic.List[String]
$CmdList.Add("rmdir /q /s C:\Twincat\3.1\Boot\CurrentConfig")
$CmdList.Add("rmdir /q /s C:\Twincat\3.1\Boot\Plc")
$CmdList.Add("mkdir C:\Twincat\3.1\Boot\Plc")
$CmdList.Add("del C:\Twincat\3.1\Boot\*.* /F /Q")
$CmdList.Add("rmdir /q /s C:\ProgramData\Beckhoff\Twincat\3.1\Boot\CurrentConfig")
$CmdList.Add("rmdir /q /s C:\ProgramData\Beckhoff\Twincat\3.1\Boot\Plc")
$CmdList.Add("mkdir C:\ProgramData\Beckhoff\Twincat\3.1\Boot\Plc")
$CmdList.Add("del C:\ProgramData\Beckhoff\Twincat\3.1\Boot\*.* /F /Q")


try {
Expand All @@ -53,8 +53,8 @@ finally {

# Prepare data for starting remote process on target
$Enc = [system.Text.Encoding]::UTF8
$Process = $Enc.GetBytes("C:\TwinCAT\3.1\Boot\PlcCleanup.bat")
$Path = $Enc.GetBytes("C:\TwinCAT\3.1\Boot")
$Process = $Enc.GetBytes("C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot\PlcCleanup.bat")
$Path = $Enc.GetBytes("C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot")
$Data = new-object byte[] 780
$Data[0] = 0x22
$Data[4] = 0x13
Expand Down Expand Up @@ -90,7 +90,7 @@ Start-Sleep -Milliseconds 1000

$ConfigFiles| ForEach-Object{
$FileSource = ($PlcBootPath + "\" + $_).Replace('\\','\')
$FileDestination = "C:\TwinCAT\3.1\Boot\"+$_
$FileDestination = "C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot\"+$_
try {
Copy-AdsFile -SessionId $Session.Id -Upload -Path $FileSource -Destination $FileDestination -Directory Generic -Force -ErrorAction Ignore
}
Expand All @@ -106,7 +106,7 @@ Start-Sleep -Milliseconds 1000
$PlcProjectFiles = Get-ChildItem -Path $PlcProjectPath -Name
$PlcProjectFiles| ForEach-Object{
$FileSource = ($PlcProjectPath + "\" + $_).Replace('\\','\')
$FileDestination = "C:\TwinCAT\3.1\Boot\Plc\"+$_
$FileDestination = "C:\ProgramData\Beckhoff\TwinCAT\3.1\Boot\Plc\"+$_
$FileSource
$FileDestination
try {
Expand Down
Loading