You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the `pathMappings` option to the debugger that can be used to map a
local to remote path and vice versa. This is useful if the local
environment has a checkout of the files being run on a remote target but
at a different path. The mappings are used to translate the paths that
will the breakpoint will be set to in the target PowerShell instance. It
is also used to update the stack trace paths received from the remote.
Launches a new PowerShell process with a custom pipe and starts a new attach configuration that will debug the new process under a child debugging session. The caller waits until the new process ends before ending the parent session.
77
78
79
+
### -------------------------- EXAMPLE 2 --------------------------
80
+
81
+
```powershell
82
+
$attachParams = @{
83
+
ComputerName = 'remote-windows'
84
+
ProcessId = $remotePid
85
+
RunspaceId = 1
86
+
PathMapping = @(
87
+
@{
88
+
localRoot = 'C:\local\path\to\scripts\'
89
+
remoteRoot = 'C:\remote\path\on\remote-windows\'
90
+
}
91
+
)
92
+
}
93
+
Start-DebugAttachSession @attachParams
94
+
```
95
+
96
+
Attaches to a remote PSSession through the WSMan parameter and maps the remote path running the script in the PSSession to the same copy of files locally. For example `remote-windows` is running the script `C:\remote\path\on\remote-windows\script.ps1` but the same script(s) are located locally on the current host `C:\local\path\to\scripts\script.ps1`.
97
+
98
+
The debug client can see the remote files as local when setting breakpoints and inspecting the callstack with this mapped path.
99
+
78
100
## PARAMETERS
79
101
80
102
### -AsJob
@@ -143,6 +165,24 @@ Accept pipeline input: False
143
165
Accept wildcard characters: False
144
166
```
145
167
168
+
### -PathMapping
169
+
170
+
An array of dictionaries with the keys `localRoot` and `remoteRoot` that maps a local and remote path root to each other. This option is useful when attaching to a PSSession running a script that is not accessible locally but can be found under a different path.
171
+
172
+
It is a good idea to ensure the `localRoot` and `remoteRoot` entries are either the absolute path to a script or ends with the trailing directory separator if specifying a directory. A path can also be mapped from a Windows and non-Windows path, just ensure the correct directory separators are used for each OS type. For example `/` for non-Windows and `\` for Windows.
173
+
174
+
```yaml
175
+
Type: IDictionary[]
176
+
Parameter Sets: (All)
177
+
Aliases:
178
+
179
+
Required: False
180
+
Position: Named
181
+
Default value: None
182
+
Accept pipeline input: False
183
+
Accept wildcard characters: False
184
+
```
185
+
146
186
### -ProcessId
147
187
148
188
The ID of the PowerShell host process that should be attached. This option is mutually exclusive with `-CustomPipeName`.
0 commit comments