Skip to content

Commit 605c21f

Browse files
committed
Article update updates
1 parent 637518d commit 605c21f

File tree

5 files changed

+58
-171
lines changed

5 files changed

+58
-171
lines changed

images/open-a-pull-request-page.png

16.3 KB
Loading

images/propose-file-change.png

35.3 KB
Loading

images/upload_files.png

29.9 KB
Loading

repo_docs/NEW_CMDLETS.md

Lines changed: 37 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,7 @@ If you need to install platyPS on old versions of Windows (Windows 8.1 or Window
1414

1515
If you need to install platyPS on really old versions of Windows (a server running a product that lacks support for WMF 5.1 or its requirements), see the [Install platyPS on really old versions of Windows](#install-platyps-on-older-versions-of-windows) section at the end of this article.
1616

17-
**Notes**:
18-
19-
- You need platyPS v0.14.0 or later (released April 2019). If you have an earlier version of platyPS installed, close all open Windows PowerShell windows where the platyPS module is currently loaded and then run `Update-Module platyPS` from a new elevated Windows PowerShell window. Or, run the command `Remove-Module platyPS` and then run `Install-Module -Name platyPS -Scope CurrentUser` to get the current version.
20-
21-
For products where all cmdlets aren't baked into the product module itself (Exchange), be aware of the following issues observed in different platyPS versions:
22-
23-
- v0.14.0: Works fine.
24-
- v0.14.1 and v0.14.2: Work fine, but produce bogus/nuisance errors using New-MarkdownHelp that can slow down operation. See this [platyPS GitHub issue](https://github.com/PowerShell/platyPS/issues/509) for details. This issue will likely be fixed in platyPS v2.0.0-Preview3.
25-
26-
If all cmdlets are baked into the product module itself, you likely won't have these issues, so it doesn't matter which version of platyPS you use.
17+
You need platyPS v0.14.0 or later (released April 2019). If you have an earlier version of platyPS installed, close all open Windows PowerShell windows where the platyPS module is currently loaded and then run `Update-Module platyPS` from a new elevated Windows PowerShell window. Or, run the command `Remove-Module platyPS` and then run `Install-Module -Name platyPS -Scope CurrentUser` to get the current version.
2718

2819
## Step 2: Connect to the PowerShell environment that has the cmdlet
2920

@@ -35,17 +26,23 @@ You probably know how to do this already, but the available workloads and connec
3526
> Use `Upgrade-Module` and also `Uninstall-Module` depending on the module version you have installed.
3627
3728
- Exchange:
38-
- Exchange Online: [Connect to Exchange Online PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-exchange-online-powershell)
39-
- Security & Compliance: [Connect to Security & Compliance PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-scc-powershell)
40-
- Exchange Online Protection: [Connect to Exchange Online Protection PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-exchange-online-protection-powershell)
41-
- Exchange Server: [Connect to Exchange servers using remote PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-exchange-servers-using-remote-powershell)
29+
- Exchange Online PowerShell: [Connect to Exchange Online PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-exchange-online-powershell)
30+
- Security & Compliance PowerShell: [Connect to Security & Compliance PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-scc-powershell)
31+
- Exchange Online Protection PowerShell: [Connect to Exchange Online Protection PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-exchange-online-protection-powershell)
32+
- Exchange Server PowerShell: [Connect to Exchange servers using remote PowerShell](https://learn.microsoft.com/powershell/exchange/connect-to-exchange-servers-using-remote-powershell)
4233

43-
> [!NOTE]
44-
> You might need to connect to the service in an elevated Windows PowerShell prompt (Teams and Exchange environments don't require this). The connection instructions article should contain this and other connection requirements.
34+
> [!TIP]
35+
> You might need to connect to the service in an elevated Windows PowerShell prompt (Teams and Exchange environments don't require an elevated Windows PowerShell prompt). The connection instructions article should plainly state this and other connection requirements.
36+
>
37+
> In Exchange and Security & Compliance PowerShell environments, the cmdlets that are available to you are controlled by role-based access control (RBAC). Most cmdlets and parameters are available to administrators by default, but some aren't (for example, the "Mailbox Search" and "Mailbox Import Export" roles.
4538
>
46-
> In Exchange environments, the cmdlets available to you are controlled by role-based access control (RBAC). Most cmdlets and parameters are available to administrators by default, but some aren't (for example, the "Mailbox Search" and "Mailbox Import Export" roles.
39+
> Remote PowerShell connections are deprecated in Exchange Online PowerShell and Security & Compliance PowerShell in favor of REST API connections. For more information, see the following articles:
4740
>
48-
> In v3.0.0 or later of the EXO V3 module, you need to connect to Exchange Online in remote PowerShell mode using the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command. If you omit the _UseRPSSession_ switch and connect in REST API mode, the **Type** value of most parameters will be the incorrect and unhelpful `Object` or `Object[]` values. For more information about the EXO V3 module, see [Updates for version 3.0.0 (the EXO V3 module)](/powershell/exchange/exchange-online-powershell-v2#updates-for-version-300-the-exo-v3-module).
41+
> - [REST API connections in the EXO V3 module](https://learn.microsoft.com/powershell/exchange/exchange-online-powershell-v2#rest-api-connections-in-the-exo-v3-module).
42+
> - [Deprecation of Remote PowerShell in Exchange Online](https://techcommunity.microsoft.com/t5/exchange-team-blog/deprecation-of-remote-powershell-in-exchange-online-re-enabling/ba-p/3779692).
43+
> - [Deprecation of Remote PowerShell (RPS) Protocol in Security & Compliance PowerShell](https://techcommunity.microsoft.com/t5/exchange-team-blog/deprecation-of-remote-powershell-rps-protocol-in-security-and/ba-p/3815432).
44+
>
45+
> REST API connections in the Exchange Online PowerShell V3 module incorrectly identify many parameter **Type** values as `Object` or `Object[]`. The true parameter type values are visible in product code.
4946
5047
## Step 3: Load platyPS in the PowerShell environment
5148

@@ -99,83 +96,34 @@ For Microsoft Teams, the module name is always `MicrosoftTeams`.
9996

10097
Either way, take note of your module name. You'll need it in the next steps.
10198

102-
### Step 5: Store your PSSession in a variable
103-
104-
> [!NOTE]
105-
> This step is required in products that use remote connections to retrieve cmdlets (Exchange). **If you're using a product where all of the cmdlets are baked into the module itself, you can skip this step**.
106-
>
107-
> As described earlier, you need to connect to Exchange Online in remote PowerShell mode using the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command. Although the [Get-ConnectionInformation](/powershell/module/exchange/get-connectioninformation) cmdlet is a reasonable replacement for Get-PSSession in REST API mode, the output doesn't work with the _Session_ parameter in **New-MarkdownHelp**. For more information about the EXO V3 module, see [Updates for version 3.0.0 (the EXO V3 module)](/powershell/exchange/exchange-online-powershell-v2#updates-for-version-300-the-exo-v3-module).
108-
109-
Do the following steps to store the remote PowerShell connection information to a variable:
110-
111-
1. Run the following command to find your session:
112-
113-
```powershell
114-
Get-PSSession | Format-Table -Auto
115-
```
116-
117-
The output will resemble this:
118-
119-
```powershell
120-
Id Name ComputerName ComputerType State ConfigurationName Availability
121-
-- ---- ------------ ------------ ----- ----------------- ------------
122-
1 ExchangeOnlineInternalSession_1 outlook.office365.com RemoteMachine Opened Microsoft.Exchange Available
123-
```
124-
125-
> [!NOTE]
126-
> If you see multiple sessions, either start over in a new PowerShell window or confirm the session you want to use. The first connection is 1, the second is 2, and so on.
127-
128-
2. Use the following syntax to store the session in a variable:
129-
130-
```powershell
131-
$<VariableName> = Get-PSSession <SessionID>
132-
```
133-
134-
For example, using the sample output in the previous step:
135-
136-
```powershell
137-
$Session = Get-PSSession 1
138-
```
139-
140-
The variable name you choose doesn't matter, but you'll use it in later steps.
141-
142-
### Step 6: Run platyPS to generate topic files
99+
### Step 5: Run platyPS to generate topic files
143100

144101
You have two choices:
145102

146103
- **Dump _all_ cmdlets in the module/snap-in to files**: This is simple but could take a while, and you'll end up with dozens or possibly hundreds of cmdlet files you don't need. The basic syntax is:
147104

148105
```powershell
149-
New-MarkdownHelp -Module <ModuleName> -OutputFolder "<Path"> [-Session <PSSessionVariableName>]
106+
New-MarkdownHelp -Module <ModuleName> -OutputFolder "<Path">
150107
```
151108

152109
- **Dump specific cmdlets to files**: This is a bit harder to set up, but the output is much quicker, and there are no extra topic files created. The basic syntax is:
153110

154111
```powershell
155-
New-MarkdownHelp -Command <Cmdlet> -OutputFolder "<Path"> [-Session <PSSessionVariableName>]
112+
New-MarkdownHelp -Command <Cmdlet> -OutputFolder "<Path">
156113
```
157114

158115
or
159116

160117
```powershell
161118
$x = "<Cmdlet1>","<Cmdlet2>",..."<CmdletN>"
162-
New-MarkdownHelp -Command $x -OutputFolder "<Path"> [-Session <PSSessionVariableName>]
119+
120+
New-MarkdownHelp -Command $x -OutputFolder "<Path">
163121
```
164122

165123
**Notes**:
166124

167125
- \<ModuleName\> is the value you found in [Step 4](#step-4-find-your-module-name) (for example, `tmp_byivwzpq.e1k` or `MicrosoftTeams`).
168126

169-
- \<PSSessionVariableName\> is the session variable from [Step 5](#step-5-store-your-pssession-in-a-variable) (for example, `$Session`) _and is required only if the cmdlets aren't baked into the module_.
170-
171-
> [!IMPORTANT]
172-
> Failure to use the _Session_ parameter in environments that need it leads to weird results in the topic file output. For example:
173-
>
174-
> - Multiple syntax blocks/parameter sets aren't recognized and are collapsed into one big block.
175-
> - The Type value is Object for all parameters.
176-
> - The Required value is False for all parameters.
177-
> - And more.
178-
179127
- If the \<Path\> ___location doesn't exist, it's created for you.
180128

181129
#### Dump all cmdlets in the module/snap-in to files
@@ -188,25 +136,23 @@ New-MarkdownHelp -Module MicrosoftTeams -OutputFolder "C:\My Docs\Teams"
188136

189137
#### Dump specific cmdlets to files
190138

191-
This example creates a topic file for the cmdlet named **Get-CoolFeature** in the Exchange Online PowerShell session where the session variable is `$Session` in the folder "C:\My Docs\ExO".
139+
This example creates a topic file for the cmdlet named **Get-CoolFeature** in the Exchange Online PowerShell session in the folder "C:\My Docs\ExO".
192140

193141
```powershell
194-
New-MarkdownHelp -Command "Get-CoolFeature" -OutputFolder "C:\My Docs\ExO" -Session $Session
142+
New-MarkdownHelp -Command "Get-CoolFeature" -OutputFolder "C:\My Docs\ExO"
195143
```
196144

197-
This example creates topic files for the **Get-CoolFeature**, **New-CoolFeature**, **Remove-CoolFeature**, and **Set-CoolFeature** cmdlets from the Exchange Online session where the session variable is `$Session` in the folder C:\My Docs\ExO.
145+
This example creates topic files for the **Get-CoolFeature**, **New-CoolFeature**, **Remove-CoolFeature**, and **Set-CoolFeature** cmdlets from the Exchange Online session in the folder C:\My Docs\ExO.
198146

199147
The first command stores the cmdlet names in a variable. The second command uses that variable to identify the cmdlets and write the output files.
200148

201149
```powershell
202150
$NewCmdlets = "Get-CoolFeature","New-CoolFeature","Remove-CoolFeature","Set-CoolFeature"
203-
```
204151
205-
```powershell
206-
New-MarkdownHelp -Command $NewCmdlets -OutputFolder "C:\My Docs\ExO" -Session $Session
152+
New-MarkdownHelp -Command $NewCmdlets -OutputFolder "C:\My Docs\ExO"
207153
```
208154

209-
### Step 7: Document the new cmdlet
155+
### Step 6: Document the new cmdlet
210156

211157
Now that you have topic files for the new cmdlets, you can actually document them. The topics are plain text UTF-8 files that are formatted using [markdown](https://guides.github.com/features/mastering-markdown/). Office writers use [Visual Studio Code](https://code.visualstudio.com/) to edit topic files, but you can use Notepad or your favorite text editor.
212158

@@ -242,7 +188,7 @@ schema: 2.0.0
242188

243189
- **external help file**: Defines which MAML/XML file the cmdlet help topic goes in for `Get-Help` at the command line. This value very product-specific, and the ___location is specified somewhere in product code. Some products (Skype) use only one XML file that's well-known and the same for all cmdlets; others (Exchange) use multiple XML files. See other topics for available values. Don't guess; a wrong value here will affect the availability of the help topic at the command line.
244190

245-
- **Module Name**: Not used in Exchange topics (remove it). For other products, this is the module name of the product.
191+
- **Module Name**: In Exchange topics, this value is `ExchangeOnlineManagement` for those few cmdlets that are [baked into the Exchange Online PowerShell V3 module itself](https://learn.microsoft.com/powershell/exchange/exchange-online-powershell-v2#cmdlets-in-the-exchange-online-powershell-module). For other products, this is the module name of the product.
246192

247193
- **online version**: This is the URL of the topic. This URL value is what makes the `Get-Help <Cmdlet> -Online` command work, so it's very important.
248194

@@ -279,16 +225,15 @@ Accept wildcard characters: False
279225

280226
Most of the attributes and values are generated automatically by platyPS. The ones that require manual intervention are:
281227

228+
- **Type**: In any environment, the values `Object` or `Object[]` are wrong. As previously described, REST API connections in the Exchange Online PowerShell V3 module incorrectly identify many parameter **Type** values as `Object` or `Object[]`. Other values like `String`, `Boolean`, and `DateTime` are detected correctly. The true parameter type values are visible in product code.
229+
282230
- **Applicable**: You need to add this attribute and value yourself. Notice the capital 'A'. See other topics for available values (same available values as the **applicable** attribute at the top of the topic). Don't invent new values here. The value **must** come from the list of predefined values.
283231

284232
- **Default value** and **Accept wildcard characters**: These attributes are present, but the values are never truthfully populated by platyPS **or any other PowerShell utility** (they're always None and False, respectively). You can correct the values if you think it's important. Otherwise, leave them as is.
285233

286-
> [!NOTE]
287-
> If the **Type** value for parameters is `Object`, then something is wrong. In Exchange Online environments, see [Step 2](#step-2-connect-to-the-powershell-environment-that-has-the-cmdlet) for an explanation of remote PowerShell mode vs. REST API mode.
288-
289234
### Step 8: Add the new cmdlet topic files to the repository
290235

291-
When you're done editing the topics, upload them to GitHub. Note that you need to fork, upload your files to your fork, then submit a Pull Request.
236+
When you're done editing the topics, upload them to GitHub. Note that you need to fork the repo, upload your files to your fork, and then submit a Pull Request.
292237

293238
1. Go to the correct ___location in the appropriate GitHub repository:
294239

@@ -300,40 +245,32 @@ When you're done editing the topics, upload them to GitHub. Note that you need t
300245
- Whiteboard: <https://github.com/MicrosoftDocs/office-docs-powershell/tree/master/whiteboard/whiteboard-ps/whiteboard>
301246
- SharePoint / OneDrive: <https://github.com/MicrosoftDocs/OfficeDocs-SharePoint-PowerShell>
302247

303-
2. Click **Upload files**
248+
2. Select **Add file** \> **Upload files**
304249

305250
![Upload file.](../images/upload_files.png)
306251

307-
3. After you're done adding files, go to the **Propose file change** section at the bottom of the page:
252+
3. After you're done adding files, go to the **Propose changes** section at the bottom of the page:
308253

309254
- A brief title is required. By default, the title is the name of the file, but you can change it.
310-
- Optionally, you can enter more details in the **Add an optional extended description** box.
255+
- Optionally, you can enter more details in the **Add an optional extended description** box. You should @ include the GitHub alias of someone who can review and approve your upload.
311256

312-
When you're ready, click the green **Propose file change** button.
257+
When you're ready, click the green **Propose changes** button.
313258

314259
![Propose file change section.](../images/propose-file-change.png)
315260

316-
4. On the **Comparing changes** page that appears, click the green **Create pull request** button.
317-
318-
![Comparing changes page.](../images/comparing-changes-page.png)
319-
320-
5. On the **Open a pull request** page that appears, click the green **Create pull request** button.
261+
4. On the **Open a pull request** page that appears, click the green **Create pull request** button.
321262

322263
![Open a pull request page.](../images/open-a-pull-request-page.png)
323264

324-
> [!NOTE]
325-
>
326-
> Your permissions in the repo determine what you see. People with no special privileges will see the **Propose file change** section and subsequent confirmation pages as described. People with permissions to create and approve their own pull requests will see a similar **Commit changes** section with extra options for creating a new branch and fewer confirmation pages.
327-
>
328-
> The point is: click any green buttons that are presented to you until there are no more.
265+
5. That's it. There's nothing more for you to do.
329266

330267
### Step 9: Add the new cmdlets to the TOC file
331268

332269
Add the cmdlet to Table of Contents (TOC) file in the GitHub repo. TOC file is the name of the module. For example:
333270

334271
- Exchange <https://github.com/MicrosoftDocs/office-docs-powershell/blob/master/exchange/exchange-ps/exchange/exchange.md>
335272

336-
> [!NOTE]
273+
> [!TIP]
337274
> Exchange also uses pseudo folders to organize cmdlets. You need to add any new cmdlets in the proper ___location in the file: <https://github.com/MicrosoftDocs/office-docs-powershell/blob/master/exchange/mapping/serviceMapping.json>.
338275
339276
- Office Web Apps: <https://github.com/MicrosoftDocs/office-docs-powershell/blob/master/officewebapps/officewebapps-ps/officewebapps/officewebapps.md>
@@ -348,30 +285,7 @@ Add the cmdlet to Table of Contents (TOC) file in the GitHub repo. TOC file is t
348285

349286
In the TOC file, you can fill in a description or remove the template text line. However, if you leave the template text line make sure it's in _exactly_ the right format so it won't render as a template text.
350287

351-
After you're done editing the TOC files:
352-
353-
1. Go to the **Propose file change** section at the bottom of the page:
354-
355-
- A brief title is required. By default, the title is the name of the file, but you can change it.
356-
- Optionally, you can enter more details in the **Add an optional extended description** box.
357-
358-
When you're ready, click the green **Propose file change** button.
359-
360-
![Propose file change section.](../images/propose-file-change.png)
361-
362-
2. On the **Comparing changes** page that appears, click the green **Create pull request** button.
363-
364-
![Comparing changes page.](../images/comparing-changes-page.png)
365-
366-
3. On the **Open a pull request** page that appears, click the green **Create pull request** button.
367-
368-
![Open a pull request page.](../images/open-a-pull-request-page.png)
369-
370-
> [!NOTE]
371-
>
372-
> Your permissions in the repo determine what you see. People with no special privileges will see the **Propose file change** section and subsequent confirmation pages as described. People with permissions to create and approve their own pull requests will see a similar **Commit changes** section with extra options for creating a new branch and fewer confirmation pages.
373-
>
374-
> The point is: click any green buttons that are presented to you until there are no more.
288+
The steps to edit and publish the TOC file are identical to modifying any existing topic. The instructions are [here](https://github.com/MicrosoftDocs/office-docs-powershell/blob/main/README.md) (you're starting at Step 4).
375289

376290
## Appendix
377291

0 commit comments

Comments
 (0)