Skip to content

Commit 8c77a4b

Browse files
committed
Add PipeName parameter to Invoke-RestMethod and Invoke-WebRequest docs
Documents the new -PipeName parameter for both Invoke-RestMethod and Invoke-WebRequest cmdlets in PowerShell 7.6, including usage examples and details about named pipe transport. This enables sending HTTP requests over local Windows named pipes.
1 parent eb7fcbb commit 8c77a4b

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

reference/7.6/Microsoft.PowerShell.Utility/Invoke-RestMethod.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ title: Invoke-RestMethod
1313
# Invoke-RestMethod
1414

1515
## SYNOPSIS
16+
1617
Sends an HTTP or HTTPS request to a RESTful web service.
1718

1819
## SYNTAX
@@ -319,6 +320,18 @@ Unix socket.
319320
Invoke-RestMethod -Uri "http://localhost/v1.40/images/json/" -UnixSocket "/var/run/docker.sock"
320321
```
321322

323+
### Example 10: Send a request over a Windows named pipe
324+
325+
This example sends a request to a local service that exposes an HTTP endpoint over a Windows named
326+
pipe.
327+
328+
```powershell
329+
Invoke-RestMethod -Uri 'http://localhost/status' -PipeName 'MyLocalHttpPipe'
330+
```
331+
332+
The host portion of the `-Uri` isn't used for network routing when `-PipeName` is supplied, but it
333+
is included in the `Host` header of the HTTP request.
334+
322335
## PARAMETERS
323336

324337
### -AllowInsecureRedirect
@@ -1350,6 +1363,36 @@ Accept pipeline input: False
13501363
Accept wildcard characters: False
13511364
```
13521365

1366+
### -PipeName
1367+
1368+
Specifies the name of a local Windows named pipe to use instead of a TCP socket when sending the
1369+
HTTP request. This lets you communicate with services that expose an HTTP-compatible protocol over
1370+
a named pipe without opening a TCP port.
1371+
1372+
Only the local machine is supported. Remote / UNC pipe names aren't supported. Supplying a value
1373+
that doesn't correspond to a listening named pipe endpoint results in a connection failure.
1374+
1375+
When `-PipeName` is specified, the `-Uri` still determines the request path, query, and scheme used
1376+
to build the HTTP request. The host portion of the `-Uri` is ignored for network routing because
1377+
the named pipe transport is always local, but it still appears in headers such as `Host`.
1378+
1379+
Security and access control for the pipe are governed by the server that created the pipe. The
1380+
client (this cmdlet) doesn't modify pipe ACLs.
1381+
1382+
This parameter was added in PowerShell 7.6.
1383+
1384+
```yaml
1385+
Type: System.String
1386+
Parameter Sets: (All)
1387+
Aliases:
1388+
1389+
Required: False
1390+
Position: Named
1391+
Default value: None
1392+
Accept pipeline input: False
1393+
Accept wildcard characters: False
1394+
```
1395+
13531396
### -Uri
13541397

13551398
Specifies the Uniform Resource Identifier (URI) of the internet resource to which the web request is

reference/7.6/Microsoft.PowerShell.Utility/Invoke-WebRequest.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ title: Invoke-WebRequest
1313
# Invoke-WebRequest
1414

1515
## SYNOPSIS
16+
1617
Gets content from a web page on the internet.
1718

1819
## SYNTAX
@@ -400,6 +401,18 @@ Unix socket.
400401
Invoke-WebRequest -Uri "http://localhost/v1.40/images/json/" -UnixSocket "/var/run/docker.sock"
401402
```
402403

404+
### Example 12: Send a request over a Windows named pipe
405+
406+
This example sends a request to a local service that exposes an HTTP endpoint over a Windows named
407+
pipe.
408+
409+
```powershell
410+
Invoke-WebRequest -Uri 'http://localhost/status' -PipeName 'MyLocalHttpPipe'
411+
```
412+
413+
The host portion of the `-Uri` isn't used for network routing when `-PipeName` is supplied, but it
414+
is included in the `Host` header of the HTTP request.
415+
403416
## PARAMETERS
404417

405418
### -AllowInsecureRedirect
@@ -1341,6 +1354,36 @@ Accept pipeline input: False
13411354
Accept wildcard characters: False
13421355
```
13431356

1357+
### -PipeName
1358+
1359+
Specifies the name of a local Windows named pipe to use instead of a TCP socket when sending the
1360+
HTTP request. This lets you communicate with services that expose an HTTP-compatible protocol over
1361+
a named pipe without opening a TCP port.
1362+
1363+
Only the local machine is supported. Remote / UNC pipe names aren't supported. Supplying a value
1364+
that doesn't correspond to a listening named pipe endpoint results in a connection failure.
1365+
1366+
When `-PipeName` is specified, the `-Uri` still determines the request path, query, and scheme used
1367+
to build the HTTP request. The host portion of the `-Uri` is ignored for network routing because
1368+
the named pipe transport is always local, but it still appears in headers such as `Host`.
1369+
1370+
Security and access control for the pipe are governed by the server that created the pipe. The
1371+
client (this cmdlet) doesn't modify pipe ACLs.
1372+
1373+
This parameter was added in PowerShell 7.6.
1374+
1375+
```yaml
1376+
Type: System.String
1377+
Parameter Sets: (All)
1378+
Aliases:
1379+
1380+
Required: False
1381+
Position: Named
1382+
Default value: None
1383+
Accept pipeline input: False
1384+
Accept wildcard characters: False
1385+
```
1386+
13441387
### -Uri
13451388

13461389
Specifies the Uniform Resource Identifier (URI) of the internet resource to which the web request is

0 commit comments

Comments
 (0)