Remove-AdsRemoteItem
SYNOPSIS
Removes a file or directory from a TwinCAT target system.
SYNTAX
NetId (Default)
Remove-AdsRemoteItem [-Path] <String> [-Recurse] [-Quiet] [-Force] [-NetId <AmsNetId>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Route
Remove-AdsRemoteItem [-Path] <String> [-Recurse] [-Quiet] [-Force] -InputObject <IRoute>
[-WhatIf] [-Confirm] [<CommonParameters>]
AddressStr
Remove-AdsRemoteItem [-Path] <String> [-Recurse] [-Quiet] [-Force] -Address <String>
[-WhatIf] [-Confirm] [<CommonParameters>]
SessionId
Remove-AdsRemoteItem [-Path] <String> [-Recurse] [-Quiet] [-Force] -SessionId <Int32>
[-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
The Remove-AdsRemoteItem cmdlet deletes a file or directory on a remote TwinCAT target. Use -Recurse to remove a directory and all its contents. Without -Recurse, only files or empty directories can be deleted. The path must include the StandardDirectory prefix (e.g., TARGETDIRsubdirfile.txt).
EXAMPLES
Example 1
Remove-AdsRemoteItem -Path \TARGETDIR\test.txt
Deletes the file 'test.txt' from the TargetDir on the local TwinCAT system.
Example 2
Remove-AdsRemoteItem -Path \TARGETDIR\MyFolder -Recurse -Force
Recursively deletes 'MyFolder' and all its contents without confirmation.
Example 3
Remove-AdsRemoteItem -Path \TARGETDIR\OldDir -Recurse -NetId "5.80.192.47.1.1"
Recursively deletes 'OldDir' on a remote TwinCAT system.
PARAMETERS
-Path
The path of the file or directory to remove on the ADS target. Must include the StandardDirectory prefix (e.g., TARGETDIRsubdirfile.txt). ADS path format: [DriveName:]StandardDirectory[RelativePath]. Accepted forms: bare (TARGETDIRfile.txt), drive-qualified (MyMachine:TARGETDIRfile.txt), or Local alias (Local:TARGETDIRfile.txt). Tab completion: Completes remote file paths on the target TwinCAT system (StandardDirectory hierarchy).
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Recurse
Recursively delete a directory and all its contents. Required when the target is a non-empty directory.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Quiet
Suppresses the confirmation prompt.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: Silent
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force
Forces the command without confirmation and resets the FailFastHandler.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NetId
The AmsNetId of the target system (Default: Local). Tab completion: Completes AmsNetId values from currently reachable routes on the local TwinCAT system.
Type: AmsNetId
Parameter Sets: NetId
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InputObject
The route of the target system. Tab completion: Completes route names from currently reachable ADS systems on the local TwinCAT system.
Type: IRoute
Parameter Sets: Route
Aliases: Route
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Address
The address of the target system. This can be the RouteName, NetId, HostName or IPAddress. Tab completion: Completes route names from currently reachable ADS systems on the local TwinCAT system.
Type: String
Parameter Sets: AddressStr
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-SessionId
The target system address is derived from the Session. Tab completion: Completes IDs of active TwinCAT sessions (created with New-TcSession).
Type: Int32
Parameter Sets: SessionId
Aliases: Id
Required: True
Position: Named
Default value: -1
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.