Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 02/05/2025
ms.date: 12/04/2025
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.6&WT.mc_id=ps-gethelp
schema: 2.0.0
aliases:
Expand All @@ -13,6 +13,7 @@ title: Invoke-RestMethod
# Invoke-RestMethod

## SYNOPSIS

Sends an HTTP or HTTPS request to a RESTful web service.

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

### Example 10: Send a request over a Windows named pipe

This example sends a request to a local service that exposes an HTTP endpoint over a Windows named
pipe.

```powershell
Invoke-RestMethod -Uri 'http://localhost/status' -PipeName 'MyLocalHttpPipe'
```

The hostname portion of the **Uri** is ignored for network routing when you supply **PipeName**, but
it's included in the `Host` header of the HTTP request.

## PARAMETERS

### -AllowInsecureRedirect
Expand Down Expand Up @@ -1350,6 +1363,36 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -PipeName

Specifies the name of a local Windows named pipe to use instead of a TCP socket when sending the
HTTP request. This lets you communicate with services that expose an HTTP-compatible protocol over
a named pipe without opening a TCP port.

Only the local machine is supported. Remote UNC pipe names aren't supported. Supplying a value that
doesn't correspond to a listening named pipe endpoint results in a connection failure.

When you specify **PipeName**, the hostname portion of the **Uri** is ignored for network routing.
The **Uri** still determines the request path, query, and scheme used to build the HTTP request. The
named pipe transport is always local, but the hostname still appears in HTTP headers.

The server that creates the pipe governs security and access control for the pipe. This cmdlet,
acting as the client, doesn't modify pipe ACLs.

This parameter was added in PowerShell 7.6.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Uri

Specifies the Uniform Resource Identifier (URI) of the internet resource to which the web request is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 02/05/2025
ms.date: 12/04/2025
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.6&WT.mc_id=ps-gethelp
schema: 2.0.0
aliases:
Expand All @@ -13,6 +13,7 @@ title: Invoke-WebRequest
# Invoke-WebRequest

## SYNOPSIS

Gets content from a web page on the internet.

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

### Example 12: Send a request over a Windows named pipe

This example sends a request to a local service that exposes an HTTP endpoint over a Windows named
pipe.

```powershell
Invoke-WebRequest -Uri 'http://localhost/status' -PipeName 'MyLocalHttpPipe'
```

The hostname portion of the **Uri** is ignored for network routing when you supply **PipeName**, but
it's included in the `Host` header of the HTTP request.

## PARAMETERS

### -AllowInsecureRedirect
Expand Down Expand Up @@ -1341,6 +1354,36 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -PipeName

Specifies the name of a local Windows named pipe to use instead of a TCP socket when sending the
HTTP request. This lets you communicate with services that expose an HTTP-compatible protocol over
a named pipe without opening a TCP port.

Only the local machine is supported. Remote UNC pipe names aren't supported. Supplying a value that
doesn't correspond to a listening named pipe endpoint results in a connection failure.

When you specify **PipeName**, the hostname portion of the **Uri** is ignored for network routing.
The **Uri** still determines the request path, query, and scheme used to build the HTTP request. The
named pipe transport is always local, but the hostname still appears in HTTP headers.

The server that creates the pipe governs security and access control for the pipe. This cmdlet,
acting as the client, doesn't modify pipe ACLs.

This parameter was added in PowerShell 7.6.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Uri

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