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
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.
76
77
78
+
### -------------------------- EXAMPLE 2 --------------------------
79
+
80
+
```powershell
81
+
$attachParams = @{
82
+
ComputerName = 'remote-windows'
83
+
ProcessId = $remotePid
84
+
RunspaceId = 1
85
+
PathMapping = @(
86
+
@{
87
+
localRoot = 'C:\local\path\to\scripts\'
88
+
remoteRoot = 'C:\remote\path\on\remote-windows\'
89
+
}
90
+
)
91
+
}
92
+
Start-DebugAttachSession @attachParams
93
+
```
94
+
95
+
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`.
96
+
97
+
The debug client can see the remote files as local when setting breakpoints and inspecting the callstack with this mapped path.
98
+
77
99
## PARAMETERS
78
100
79
101
### -AsJob
@@ -142,6 +164,24 @@ Accept pipeline input: False
142
164
Accept wildcard characters: False
143
165
```
144
166
167
+
### -PathMapping
168
+
169
+
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.
170
+
171
+
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.
172
+
173
+
```yaml
174
+
Type: IDictionary[]
175
+
Parameter Sets: (All)
176
+
Aliases:
177
+
178
+
Required: False
179
+
Position: Named
180
+
Default value: None
181
+
Accept pipeline input: False
182
+
Accept wildcard characters: False
183
+
```
184
+
145
185
### -ProcessId
146
186
147
187
The ID of the PowerShell host process that should be attached. This option is mutually exclusive with `-CustomPipeName`.
0 commit comments