Skip to content

Commit a918ac7

Browse files
authored
Merge pull request #13464 from kawkaur/user/kawkaur/update-whiteboardAdmin-module
Update whiteboardAdmin module with export cmdlet
2 parents 04189d9 + 30afb21 commit a918ac7

3 files changed

Lines changed: 609 additions & 5 deletions

File tree

Lines changed: 396 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,396 @@
1+
---
2+
external help file: WhiteboardAdmin-help.xml
3+
Module Name: WhiteboardAdmin
4+
online version: https://learn.microsoft.com/powershell/module/whiteboard/export-whiteboardhtml
5+
applicable: Microsoft Whiteboard
6+
title: Export-WhiteboardHtml
7+
schema: 2.0.0
8+
author: serdarsoysal
9+
ms.author: serdars
10+
ms.reviewer:
11+
---
12+
13+
# Export-WhiteboardHtml
14+
15+
## SYNOPSIS
16+
17+
Exports Microsoft Whiteboards to HTML files using the Microsoft Graph API.
18+
19+
## SYNTAX
20+
21+
### User mode
22+
23+
```
24+
Export-WhiteboardHtml -Mode User -Environment <String> [-OutputPath <String>] [-Force]
25+
[-LogLevel <String>] [-ThrottleDelayMs <Int32>] [-LoginAs <String>] [<CommonParameters>]
26+
```
27+
28+
### Admin mode
29+
30+
```
31+
Export-WhiteboardHtml -Mode Admin -TenantId <String> -Environment <String>
32+
[-UserListCsv <String>] [-UserList <String[]>] [-OutputPath <String>] [-Force]
33+
[-LogLevel <String>] [-ThrottleDelayMs <Int32>] [-MaxUsers <Int32>] [-LoginAs <String>]
34+
[<CommonParameters>]
35+
```
36+
37+
## DESCRIPTION
38+
39+
Exports Microsoft Whiteboards to HTML files using the Microsoft Graph API. The command works in two
40+
modes:
41+
42+
- **User mode**: exports your own whiteboards (no admin rights needed).
43+
- **Admin mode**: exports whiteboards for all users in a tenant, or a specific subset.
44+
45+
### Prerequisites
46+
47+
- PowerShell 5.1 or later (PowerShell 7+ recommended for large tenants).
48+
- Microsoft Graph PowerShell SDK. Install with `Install-Module Microsoft.Graph -Scope CurrentUser`.
49+
50+
### Required permissions
51+
52+
The permissions below are delegated — they apply to the signed-in user account, not an app
53+
registration.
54+
55+
| Mode | Permission | Purpose |
56+
|------|-----------|---------|
57+
| User | User.Read | Read your own profile to get your user ID |
58+
| User | Files.Read | Read your own OneDrive to find and convert whiteboard files |
59+
| Admin | User.Read.All | List all users in the tenant |
60+
| Admin | Files.Read.All | Read any user's OneDrive to find and convert whiteboard files |
61+
62+
Admin mode permissions require admin consent. To grant it:
63+
64+
1. Go to **Entra admin center** \> **Applications** \> **App registrations**.
65+
2. Find **Microsoft Graph PowerShell**.
66+
3. Go to **API permissions** \> **Add a permission** \> **Microsoft Graph** \> **Delegated
67+
permissions**.
68+
4. Add **User.Read.All** and **Files.Read.All**.
69+
5. Click **Grant admin consent**.
70+
71+
### Output structure
72+
73+
**User mode**:
74+
75+
```
76+
Downloads\
77+
WhiteboardExports\
78+
Whiteboard Title 1.html
79+
Whiteboard Title 2.html
80+
export_log.txt
81+
export_state.json
82+
export_summary.json
83+
```
84+
85+
**Admin mode**:
86+
87+
```
88+
Downloads\
89+
WhiteboardExports_contoso.onmicrosoft.com\
90+
alice@contoso.com\
91+
Whiteboard Title 1.html
92+
bob@contoso.com\
93+
Quarterly Planning.html
94+
Team Brainstorm.html
95+
export_log.txt
96+
export_state.json
97+
export_summary.json
98+
```
99+
100+
| File | Description |
101+
|------|-------------|
102+
| \*.html | Exported whiteboard content |
103+
| export\_log.txt | Timestamped log of every action (always written, regardless of `-LogLevel`) |
104+
| export\_state.json | Run state used for resume and retry |
105+
| export\_summary.json | Final statistics: users processed, exports succeeded/failed, duration |
106+
107+
### Resuming an interrupted run
108+
109+
If the export is interrupted (network failure, session timeout, manual stop), run the same command
110+
again. It automatically picks up where it left off — users already processed are skipped. To ignore
111+
the saved state and start over from scratch, use the `-Force` parameter.
112+
113+
## EXAMPLES
114+
115+
### EXAMPLE 1
116+
117+
```powershell
118+
Export-WhiteboardHtml -Mode User -Environment AzureCloud
119+
```
120+
121+
Export your own whiteboards from a commercial tenant.
122+
123+
124+
### EXAMPLE 2
125+
126+
```powershell
127+
Export-WhiteboardHtml -Mode Admin -TenantId contoso.onmicrosoft.com -Environment AzureCloud
128+
```
129+
130+
Export whiteboards for all users in a commercial tenant.
131+
132+
### EXAMPLE 3
133+
134+
```powershell
135+
Export-WhiteboardHtml -Mode Admin -TenantId contoso.onmicrosoft.com -Environment AzureCloud `
136+
-UserList @('alice@contoso.com', 'bob@contoso.com')
137+
```
138+
139+
Export whiteboards for a specific list of users provided inline.
140+
141+
### EXAMPLE 4
142+
143+
```powershell
144+
Export-WhiteboardHtml -Mode Admin -TenantId contoso.onmicrosoft.com -Environment AzureCloud `
145+
-UserListCsv C:\migration\users.csv
146+
```
147+
148+
Export whiteboards for users listed in a CSV file. The CSV must have a column named
149+
`UserPrincipalName` (or the UPNs in the first column).
150+
151+
### EXAMPLE 5
152+
153+
```powershell
154+
Export-WhiteboardHtml -Mode Admin -TenantId contoso.onmicrosoft.com -Environment AzureCloud `
155+
-MaxUsers 10
156+
```
157+
158+
Export only the first 10 users (useful for testing).
159+
160+
### EXAMPLE 6
161+
162+
```powershell
163+
Export-WhiteboardHtml -Mode Admin -TenantId contoso.onmicrosoft.com -Environment AzureCloud `
164+
-OutputPath C:\Exports
165+
```
166+
167+
Save output to a custom folder instead of the default Downloads folder.
168+
169+
### EXAMPLE 7
170+
171+
```powershell
172+
Export-WhiteboardHtml -Mode Admin -TenantId contoso.onmicrosoft.com -Environment AzureCloud `
173+
-LoginAs admin@contoso.com
174+
```
175+
176+
Sign in as a specific account (useful when multiple accounts are cached).
177+
178+
## PARAMETERS
179+
180+
### -Mode
181+
182+
Specifies the export mode. Use `User` to export your own whiteboards or `Admin` to export
183+
whiteboards for all users (or a subset) in a tenant.
184+
185+
```yaml
186+
Type: System.String
187+
Parameter Sets: (All)
188+
Accepted values: User, Admin
189+
190+
Required: True
191+
Position: Named
192+
Default value: None
193+
Accept pipeline input: False
194+
Accept wildcard characters: False
195+
```
196+
197+
### -Environment
198+
199+
The target cloud environment. Must match the cloud your tenant is in. Using the wrong value causes
200+
authentication to fail or connects to the wrong tenant.
201+
202+
| Value | Cloud | Graph endpoint |
203+
|-------|-------|----------------|
204+
| AzureCloud | Commercial / GCC | graph.microsoft.com |
205+
| AzureUSGovernment | GCC-High | graph.microsoft.us |
206+
| AzureUSDoD | DoD | dod-graph.microsoft.us |
207+
| AzureUSNat | Air-Gap (USNat) | graph.eaglex.ic.gov |
208+
| AzureUSSec | Air-Gap (USSec) | graph.microsoft.scloud |
209+
210+
```yaml
211+
Type: System.String
212+
Parameter Sets: (All)
213+
Accepted values: AzureCloud, AzureUSGovernment, AzureUSDoD, AzureUSNat, AzureUSSec
214+
215+
Required: True
216+
Position: Named
217+
Default value: None
218+
Accept pipeline input: False
219+
Accept wildcard characters: False
220+
```
221+
222+
### -TenantId
223+
224+
The tenant domain or GUID (for example, `contoso.onmicrosoft.com`). Required in Admin mode.
225+
226+
```yaml
227+
Type: System.String
228+
Parameter Sets: Admin
229+
230+
Required: True
231+
Position: Named
232+
Default value: None
233+
Accept pipeline input: False
234+
Accept wildcard characters: False
235+
```
236+
237+
### -UserListCsv
238+
239+
Path to a CSV file containing the UPNs of users to process. The CSV must have a column named
240+
`UserPrincipalName` (or the UPNs in the first column). Admin mode only.
241+
242+
```yaml
243+
Type: System.String
244+
Parameter Sets: Admin
245+
246+
Required: False
247+
Position: Named
248+
Default value: None
249+
Accept pipeline input: False
250+
Accept wildcard characters: False
251+
```
252+
253+
### -UserList
254+
255+
An inline array of UPNs to process. Admin mode only.
256+
257+
```yaml
258+
Type: System.String[]
259+
Parameter Sets: Admin
260+
261+
Required: False
262+
Position: Named
263+
Default value: None
264+
Accept pipeline input: False
265+
Accept wildcard characters: False
266+
```
267+
268+
### -OutputPath
269+
270+
Base directory for output. Defaults to the current user's Downloads folder.
271+
272+
```yaml
273+
Type: System.String
274+
Parameter Sets: (All)
275+
Aliases:
276+
277+
Required: False
278+
Position: Named
279+
Default value: Downloads folder
280+
Accept pipeline input: False
281+
Accept wildcard characters: False
282+
```
283+
284+
### -Force
285+
286+
Discard saved state and start a completely fresh run.
287+
288+
```yaml
289+
Type: System.Management.Automation.SwitchParameter
290+
Parameter Sets: (All)
291+
Aliases:
292+
293+
Required: False
294+
Position: Named
295+
Default value: False
296+
Accept pipeline input: False
297+
Accept wildcard characters: False
298+
```
299+
300+
### -LogLevel
301+
302+
Console verbosity level: `Quiet`, `Normal`, or `Verbose`. The export\_log.txt file always contains
303+
full details regardless of this setting.
304+
305+
```yaml
306+
Type: System.String
307+
Parameter Sets: (All)
308+
Aliases:
309+
Accepted values: Quiet, Normal, Verbose
310+
311+
Required: False
312+
Position: Named
313+
Default value: Normal
314+
Accept pipeline input: False
315+
Accept wildcard characters: False
316+
```
317+
318+
### -ThrottleDelayMs
319+
320+
Milliseconds to pause between API calls. Increase this value for large tenants to avoid throttling.
321+
322+
```yaml
323+
Type: System.Int32
324+
Parameter Sets: (All)
325+
Aliases:
326+
327+
Required: False
328+
Position: Named
329+
Default value: 100
330+
Accept pipeline input: False
331+
Accept wildcard characters: False
332+
```
333+
334+
### -MaxUsers
335+
336+
Maximum number of users to process. Admin mode only. Useful for testing.
337+
338+
```yaml
339+
Type: System.Int32
340+
Parameter Sets: Admin
341+
Aliases:
342+
343+
Required: False
344+
Position: Named
345+
Default value: 9999
346+
Accept pipeline input: False
347+
Accept wildcard characters: False
348+
```
349+
350+
### -LoginAs
351+
352+
UPN hint shown before the sign-in prompt. Useful when multiple accounts are cached.
353+
354+
```yaml
355+
Type: System.String
356+
Parameter Sets: (All)
357+
Aliases:
358+
359+
Required: False
360+
Position: Named
361+
Default value: None
362+
Accept pipeline input: False
363+
Accept wildcard characters: False
364+
```
365+
366+
### CommonParameters
367+
368+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
369+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
370+
-WarningAction, and -WarningVariable. For more information, see
371+
[about_CommonParameters](https://go.microsoft.com/fwlink/p/?LinkID=113216)
372+
373+
## INPUTS
374+
375+
## OUTPUTS
376+
377+
## NOTES
378+
379+
A browser window opens on first run to sign in. After that, your session is cached and sign-in is
380+
not required again unless the token expires.
381+
382+
For details on the module, see the [overview page](../../docs-conceptual/overview.md).
383+
384+
### Troubleshooting
385+
386+
- **Sign-in window does not appear**: Run `Connect-MgGraph -Scopes 'User.Read.All', 'Files.Read.All', 'Sites.Read.All'` manually in your PowerShell session first, then re-run the export.
387+
- **"Insufficient privileges" or "Access denied" errors**: Admin consent may not have been granted for `User.Read.All` and `Files.Read.All`. See Required Permissions. After granting consent, run with `-Force` to reconnect with the updated permissions.
388+
- **A user is skipped with "No Whiteboards folder / no OneDrive"**: The user has never activated OneDrive, or their OneDrive has been deleted. This is expected and not an error.
389+
- **Some whiteboards failed to export**: Run [Invoke-WhiteboardHtmlRetry](Invoke-WhiteboardHtmlRetry.md) with the same parameters to re-attempt them. Check `export_log.txt` for per-failure error details.
390+
- **Throttling / slow runs on large tenants**: Increase the delay between API calls with `-ThrottleDelayMs 500`.
391+
- **Exported HTML is empty or corrupted**: The whiteboard may be empty or in a format the Graph API cannot convert. Check `export_log.txt` for details on that specific file.
392+
- **Run is stuck / making no progress**: Run with `-LogLevel Verbose` to see detailed output, including each Graph API call.
393+
394+
## RELATED LINKS
395+
396+
[Invoke-WhiteboardHtmlRetry](Invoke-WhiteboardHtmlRetry.md)

0 commit comments

Comments
 (0)