Skip to content

Commit 1e0a34f

Browse files
authored
Update warning about parsed content (#12466)
1 parent 0d2a011 commit 1e0a34f

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 02/05/2025
5+
ms.date: 10/29/2025
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -37,16 +37,12 @@ the Item or Entry XML nodes. For JavaScript Object Notation (JSON) or XML, Power
3737
deserializes, the content into `[pscustomobject]` objects. Comments aren't permitted in the JSON
3838
data.
3939

40-
> [!NOTE]
41-
> When the REST endpoint returns multiple objects, the objects are received as an array. If you pipe
42-
> the output from `Invoke-RestMethod` to another command, it is sent as a single `[Object[]]`
43-
> object. The contents of that array are not enumerated for the next command on the pipeline.
40+
> [!WARNING]
41+
> By default, `Invoke-RestMethod` parses the content of the web page. Script code in the web page
42+
> might be run when the page is parsed. Use the `-UseBasicParsing` switch to avoid script code
43+
> execution.
4444
45-
This cmdlet is introduced in Windows PowerShell 3.0.
46-
47-
> [!NOTE]
48-
> By default, script code in the web page may be run when the page is being parsed to populate the
49-
> `ParsedHtml` property. Use the **UseBasicParsing** switch to suppress this.
45+
This cmdlet is introduced in Windows PowerShell 3.0. This command can be run using the `irm` alias.
5046

5147
## EXAMPLES
5248

@@ -737,6 +733,10 @@ Windows PowerShell includes the following aliases for `Invoke-RestMethod`:
737733

738734
- `irm`
739735

736+
When the REST endpoint returns multiple objects, the objects are received as an array. If you pipe
737+
the output from `Invoke-RestMethod` to another command, it's sent as a single `[Object[]]` object.
738+
The contents of that array aren't enumerated for the next command on the pipeline.
739+
740740
## RELATED LINKS
741741

742742
[ConvertTo-Json](ConvertTo-Json.md)

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 01/25/2024
5+
ms.date: 10/29/2025
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -37,15 +37,12 @@ significant HTML elements.
3737

3838
This cmdlet was introduced in Windows PowerShell 3.0.
3939

40-
> [!NOTE]
41-
> By default, script code in the web page may be run when the page is being parsed to populate the
42-
> `ParsedHtml` property. Use the `-UseBasicParsing` switch to suppress this.
40+
> [!WARNING]
41+
> By default, `Invoke-WebRequest` parses the content of the web page. Script code in the web page
42+
> might be run when the page is parsed. Use the `-UseBasicParsing` switch to avoid script code
43+
> execution.
4344
44-
> [!IMPORTANT]
45-
> The examples in this article reference hosts in the `contoso.com` domain. This is a fictitious
46-
> domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets.
47-
> However, since the `contoso.com` sites don't exist, the examples don't work. Adapt the examples
48-
> to hosts in your environment.
45+
This command can be run using the `iwr`, `curl`, or `wget` aliases.
4946

5047
## EXAMPLES
5148

@@ -155,7 +152,7 @@ $StatusCode
155152
The terminating error is caught by the `catch` block, which retrieves the **StatusCode** from the
156153
**Exception** object.
157154

158-
### Example 8: Download multiple files at the same time
155+
### Example 5: Download multiple files at the same time
159156

160157
The `Invoke-WebRequest` cmdlet can only download one file at a time. The following example uses
161158
`Start-ThreadJob` to create multiple thread jobs to download multiple files at the same time.
@@ -221,13 +218,13 @@ request content to the form fields.
221218
For example:
222219

223220
`$r = Invoke-WebRequest https://website.com/login.aspx`
224-
`$r.Forms\[0\].Name = "MyName"`
225-
`$r.Forms\[0\].Password = "MyPassword"`
221+
`$r.Forms[0].Name = "MyName"`
222+
`$r.Forms[0].Password = "MyPassword"`
226223
`Invoke-RestMethod https://website.com/service.aspx -Body $r`
227224

228225
- or -
229226

230-
`Invoke-RestMethod https://website.com/service.aspx -Body $r.Forms\[0\]`
227+
`Invoke-RestMethod https://website.com/service.aspx -Body $r.Forms[0]`
231228

232229
```yaml
233230
Type: System.Object
@@ -761,6 +758,8 @@ This cmdlet returns the response object representing the result of the web reque
761758
Windows PowerShell includes the following aliases for `Invoke-WebRequest`:
762759

763760
- `iwr`
761+
- `curl`
762+
- `wget`
764763

765764
## RELATED LINKS
766765

0 commit comments

Comments
 (0)