Skip to content

Commit 8e28c38

Browse files
authored
Merge branch 'dev' into TransitiveGroupMembers
2 parents 58cf871 + dc8904d commit 8e28c38

File tree

269 files changed

+5402
-4469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+5402
-4469
lines changed

.vscode/launch.json

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,58 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "PowerShell cmdlets: pwsh",
8+
"name": "Debug with nugets in new PowerShell session",
99
"type": "coreclr",
1010
"request": "launch",
1111
"preLaunchTask": "Build with nugets",
12+
"args": [],
13+
"cwd": "${workspaceFolder}",
14+
"stopAtEntry": false,
15+
"console": "externalTerminal",
1216
"program": "pwsh",
13-
"args": [
14-
"-NoExit",
15-
"-NoProfile",
16-
"-Command",
17-
"Import-Module ${userHome}/.local/share/powershell/Modules/PnP.PowerShell.psd1",
18-
],
17+
"osx": {
18+
"program": "pwsh",
19+
},
20+
"windows": {
21+
"program": "pwsh.exe"
22+
}
23+
},
24+
{
25+
"preLaunchTask": "Build with nugets",
26+
"name": "Debug with nugets in existing PowerShell session",
27+
"type": "coreclr",
28+
"request": "attach",
29+
"processId": "${command:pickProcess}",
30+
},
31+
{
32+
"name": "Debug with local copy of PnP Framework in new PowerShell session",
33+
"type": "coreclr",
34+
"request": "launch",
35+
"preLaunchTask": "Build with local copy of PnP Framework",
36+
"args": [],
1937
"cwd": "${workspaceFolder}",
2038
"stopAtEntry": false,
21-
"console": "externalTerminal"
39+
"console": "externalTerminal",
40+
"program": "pwsh",
41+
"osx": {
42+
"program": "pwsh",
43+
},
44+
"windows": {
45+
"program": "pwsh.exe"
46+
}
2247
},
2348
{
24-
"name": ".NET Core Launch with Nuget Build(console)",
49+
"preLaunchTask": "Build with local copy of PnP Framework",
50+
"name": "Debug with local copy of PnP Framework in existing PowerShell session",
51+
"type": "coreclr",
52+
"request": "attach",
53+
"processId": "${command:pickProcess}",
54+
},
55+
{
56+
"name": "Debug with local copy of PnP Core in new PowerShell session",
2557
"type": "coreclr",
2658
"request": "launch",
27-
"preLaunchTask": "Build with nugets",
59+
"preLaunchTask": "Build with local copy of PnP Core SDK",
2860
"args": [],
2961
"cwd": "${workspaceFolder}",
3062
"stopAtEntry": false,
@@ -38,8 +70,38 @@
3870
}
3971
},
4072
{
41-
"preLaunchTask": "Build with nugets",
42-
"name": ".NET Core Attach",
73+
"preLaunchTask": "Build with local copy of PnP Core SDK",
74+
"name": "Debug with local copy of PnP Core in existing PowerShell session",
75+
"type": "coreclr",
76+
"request": "attach",
77+
"processId": "${command:pickProcess}",
78+
},
79+
{
80+
"name": "Debug with local copy of PnP Framework and Core in new PowerShell session",
81+
"type": "coreclr",
82+
"request": "launch",
83+
"preLaunchTask": "Build with local copy of PnP Framework/PnP Core SDK",
84+
"args": [],
85+
"cwd": "${workspaceFolder}",
86+
"stopAtEntry": false,
87+
"console": "externalTerminal",
88+
"program": "pwsh",
89+
"osx": {
90+
"program": "pwsh",
91+
},
92+
"windows": {
93+
"program": "pwsh.exe"
94+
}
95+
},
96+
{
97+
"preLaunchTask": "Build with local copy of PnP Framework/PnP Core SDK",
98+
"name": "Debug with local copy of PnP Framework and Core in existing PowerShell session",
99+
"type": "coreclr",
100+
"request": "attach",
101+
"processId": "${command:pickProcess}",
102+
},
103+
{
104+
"name": "Attach to existing PowerShell session",
43105
"type": "coreclr",
44106
"request": "attach",
45107
"processId": "${command:pickProcess}",

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6060
- Added `Set-PnPSiteDocumentIdPrefix` which allows changing of the document id prefix on a site collection [#4765](https://github.com/pnp/powershell/pull/4765)
6161
- Added `Get-PnPMicrosoft365Roadmap` which allows retrieval of the Microsoft 365 Roadmap items [#4764](https://github.com/pnp/powershell/pull/4764)
6262
- Added `-Name` parameter to `Add-PnPApplicationCustomizer` cmdlet to allow for specifying the name of the application customizer [#4767](https://github.com/pnp/powershell/pull/4767)
63+
- Added `Get-PnPTraceLog` cmdlet which allows reading from the detailed in memory logs of the PnP PowerShell cmdlet execution [#4794](https://github.com/pnp/powershell/pull/4794)
6364

6465
### Changed
6566

@@ -91,6 +92,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
9192
- `Set-PnPPropertyBagValue` and `Remove-PnPPropertyBagValue` now toggle the NoScript status of the site to allow setting/removing property bag values, but only if the tenant wide `AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled` is not enabled [#4680](https://github.com/pnp/powershell/pull/4680)
9293
- `Get-PnPTenant` now uses nullable types for the properties that can return null if the property is not set or could not be retrieved. Beware that the property `PublicCdnOrigins` has been renamed to `PublicCdnOriginParsed `. All other property names will remain the same. [#4722](https://github.com/pnp/powershell/pull/4722)
9394
- Removed `New-PnPMicrosoft365Group` setting the group visibility options twice when providing `-HideFromAddressLists` and/or `-HideFromOutlookClients` and adding logging around trying to set the group visibility [#4791](https://github.com/pnp/powershell/pull/4791)
95+
- Visual Studio Code launch profiles have been cleaned up and restructured [#4808](https://github.com/pnp/powershell/pull/4804)
9496

9597
### Fixed
9698

@@ -141,6 +143,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
141143

142144
### Contributors
143145

146+
- Abhijeet Jadhav [TekExpo]
144147
- [abwlodar]
145148
- [jgfgoncalves]
146149
- Stephen Cox [stephen-cox-nzx]

dependencies.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"Updated": "20250318-025120",
2+
"Updated": "20250322-024803",
33
"PnPPowerShell": "fc00b8be38d36cbafb5a220f1b3652b6ce3ac7b3",
4-
"PnPFramework": "f6ed006a5c36f2ef04956e3013454d609fed4d8c",
5-
"PnPCore": "430c2316197d9cd00269c878f9ce0eff7a7bac25"
4+
"PnPFramework": "1cea07866e50bdfe2eaf4a5b8a87961650b8e09f",
5+
"PnPCore": "76660cf4c625a9e7b4dee3e35d96daeb7dfcb7dd"
66
}

documentation/Clear-PnPTraceLog.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
title: Clear-PnPTraceLog
4+
schema: 2.0.0
5+
applicable: SharePoint Online
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
online version: https://pnp.github.io/powershell/cmdlets/Clear-PnPTraceLog.html
8+
---
9+
10+
# Clear-PnPTraceLog
11+
12+
## SYNOPSIS
13+
Clears the log stream in memory
14+
15+
## SYNTAX
16+
17+
```powershell
18+
Clear-PnPTraceLog [-Verbose]
19+
```
20+
21+
## DESCRIPTION
22+
This clears the in memory stored log stream which was started with the [Start-PnPTraceLog -WriteToLogstream](Start-PnPTraceLog.md) cmdlet. It will not clear the log file if one was specified.
23+
24+
## EXAMPLES
25+
26+
### EXAMPLE 1
27+
```powershell
28+
Clear-PnPTraceLog
29+
```
30+
31+
This clears the in memory stored log stream
32+
33+
## PARAMETERS
34+
35+
### -Verbose
36+
When provided, additional debug statements will be shown while executing the cmdlet.
37+
38+
```yaml
39+
Type: SwitchParameter
40+
Parameter Sets: (All)
41+
42+
Required: False
43+
Position: Named
44+
Default value: None
45+
Accept pipeline input: False
46+
Accept wildcard characters: False
47+
```
48+
49+
## RELATED LINKS
50+
51+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

documentation/Get-PnPTraceLog.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
title: Get-PnPTraceLog
4+
schema: 2.0.0
5+
applicable: SharePoint Online
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTraceLog.html
8+
---
9+
10+
# Get-PnPTraceLog
11+
12+
## SYNOPSIS
13+
Returns logged messages during the execution of PnP PowerShell cmdlets
14+
15+
## SYNTAX
16+
17+
### Log from file
18+
19+
```powershell
20+
Get-PnPTraceLog -Path <string> [-Verbose]
21+
```
22+
### Log from log stream
23+
24+
```powershell
25+
Get-PnPTraceLog [-Verbose]
26+
```
27+
28+
## DESCRIPTION
29+
This cmdlet returns the logged messages during the execution of PnP PowerShell cmdlets. It can return the messages from an in memory log stream or from a file. Note that you cannot read from a log file if it is currently in use to write to. In this case, you would first have to stop logging to it using [Stop-PnPTraceLog](Stop-PnPTraceLog.md) and then read the log file. The in memory log stream is always available.
30+
31+
You can use [Start-PnPTraceLog](Start-PnPTraceLog.md) to start logging to a file and/or to an in memory stream.
32+
33+
## EXAMPLES
34+
35+
### EXAMPLE 1
36+
```powershell
37+
Get-PnPTraceLog
38+
```
39+
40+
This returns all items in the in memory stored log stream
41+
42+
### EXAMPLE 2
43+
```powershell
44+
Get-PnPTraceLog -Path "C:\temp\log.txt"
45+
```
46+
47+
This returns all items from the log file stored at the provided location. Note that you cannot read from a log file if it is currently in use to write to. In this case, you would first have to stop logging to it using [Stop-PnPTraceLog](Stop-PnPTraceLog.md) and then read the log file.
48+
49+
### EXAMPLE 3
50+
```powershell
51+
Get-PnPTraceLog | Where-Object { $_.Level -eq "Error" }
52+
```
53+
54+
This returns only logged items from the in memory stored log stream that have a level of "Error"
55+
56+
### EXAMPLE 4
57+
```powershell
58+
Get-PnPTraceLog | Where-Object { $_.CorrelationId -eq "5a6206a0-6c83-4446-9d1b-38c14f93cb60" }
59+
```
60+
61+
This returns only logged items from the in memory stored log stream that happened during the execution of a PnP PowerShell cmdlet with the provided correlation id. This is useful to find out what happened during the execution of a specific cmdlet. Mind that the correlation id is an unique identifier for the cmdlet execution assigned by PnP PowerShell and is not the same as the correlation id of a SharePoint operation.
62+
63+
### EXAMPLE 5
64+
```powershell
65+
Get-PnPTraceLog | Sort-Object -Property EllapsedMilliseconds -Descending -Top 10 | Select EllapsedMilliseconds, Source, Message
66+
```
67+
68+
Returns the 10 longest running operations from the in memory stored log stream. An operation is an action within the execution of a cmdlet. The output is sorted by the time it took to complete the operation with the longest execution at the top. The output shows the ellapsed time in milliseconds taken by a single operation, the cmdlet that was executed and the message that was logged.
69+
70+
### EXAMPLE 6
71+
```powershell
72+
Get-PnPTraceLog | Group-Object -Property CorrelationId | ForEach-Object { [pscustomobject]@{ Started = ($_.Group | Select -First 1).TimeStamp; Ended = ($_.Group | Select -Last 1).TimeStamp; Cmdlet = $_.Group[0].Source; TimeTaken = ($_.Group | Measure-Object -Property EllapsedMilliseconds -Sum).Sum; Logs = $_.Group }} | Sort-Object -Property TimeTaken -Descending -Top 5 | Select Started, Cmdlet, TimeTaken
73+
```
74+
75+
Returns the top 5 longest running cmdlets from the in memory stored log stream. The output is sorted by the TimeTaken property in descending order which shows the total execution time of a single cmdlet. The output contains the time the cmdlet started executing, the cmdlet that was executed and the total time it took to execute the cmdlet. From there it is easy to examine all the individual logs collected during the execution of that single cmdlet.
76+
77+
## PARAMETERS
78+
79+
### -Path
80+
The path to the log file. If not provided, the cmdlet will return the in memory log stream.
81+
82+
Note that you cannot read from a log file if it is currently in use to write to. In this case, you would first have to stop logging to it using [Stop-PnPTraceLog](Stop-PnPTraceLog.md) and then read the log file.
83+
84+
```yaml
85+
Type: String
86+
Parameter Sets: Log from file
87+
88+
Required: True
89+
Position: Named
90+
Default value: None
91+
Accept pipeline input: True
92+
Accept wildcard characters: False
93+
```
94+
95+
### -Verbose
96+
When provided, additional debug statements will be shown while executing the cmdlet.
97+
98+
```yaml
99+
Type: SwitchParameter
100+
Parameter Sets: (All)
101+
102+
Required: False
103+
Position: Named
104+
Default value: None
105+
Accept pipeline input: False
106+
Accept wildcard characters: False
107+
```
108+
109+
## RELATED LINKS
110+
111+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

documentation/Start-PnPTraceLog.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,26 @@ Starts log tracing
1515
## SYNTAX
1616

1717
```powershell
18-
Start-PnPTraceLog [-Path <String>] [-Level <LogLevel>] [-AutoFlush <Boolean>] [-WriteToConsole <SwitchParameter>]
18+
Start-PnPTraceLog [-Path <String>] [-Level <LogLevel>] [-AutoFlush <Boolean>] [-WriteToConsole <SwitchParameter>] [-WriteToLogStream <SwitchParameter>]
1919
```
2020

21-
2221
## DESCRIPTION
2322
Starts .NET tracelogging. Many cmdlets output detailed trace information when executed. Turn on the trace log with this cmdlet, optionally specify the level. By default the level is set to 'Information', but you will receive more detail by setting the level to 'Debug'.
2423

24+
You can look at the logged data using [Get-PnPTraceLog](Get-PnPTraceLog.md).
25+
26+
The logged data contains the following information in the following order:
27+
28+
- Timestamp
29+
- Source
30+
- Thread ID
31+
- Log level
32+
- Message
33+
- Elapsed time in milliseconds since the last log entry for the same cmdlet execution
34+
- Correlation ID which is an unique identifier per executed cmdlet so you can filter the log for everything logged during a specific cmdlet execution
35+
36+
Beware that the logged data can be quite verbose, especially when the level is set to 'Debug'. When logging in memory, it can take up a lot of memory. When logging to a file, it can take up a lot of disk space. So be careful when using this in production environments and only use it when you need to troubleshoot something or are aware of the consequences.
37+
2538
## EXAMPLES
2639

2740
### EXAMPLE 1
@@ -38,12 +51,19 @@ Start-PnPTraceLog -Path ./TraceOutput.txt -Level Debug
3851

3952
This turns on trace logging to the file 'TraceOutput.txt' and will capture all events.
4053

54+
### EXAMPLE 3
55+
```powershell
56+
Start-PnPTraceLog -WriteToConsole -WriteToLogStream -Level Debug
57+
```
58+
59+
This turns on trace logging to the console and in memory stream in which you are running your PowerShell script and will capture all events.
60+
4161
### EXAMPLE 3
4262
```powershell
4363
Start-PnPTraceLog -WriteToConsole -Level Debug
4464
```
4565

46-
This turns on trace logging to console in which you are running your PowerShell script and will capture all events.
66+
This turns on trace logging to the console in which you are running your PowerShell script and will capture all events.
4767

4868
## PARAMETERS
4969

@@ -104,6 +124,20 @@ Accept pipeline input: False
104124
Accept wildcard characters: False
105125
```
106126
127+
### -WriteToLogStream
128+
Write the trace log to the in memory stream. Use [Get-PnPTraceLog](Get-PnPTraceLog.md) to read the log stream.
129+
130+
```yaml
131+
Type: SwitchParameter
132+
Parameter Sets: (All)
133+
134+
Required: False
135+
Position: Named
136+
Default value: False
137+
Accept pipeline input: False
138+
Accept wildcard characters: False
139+
```
140+
107141
## RELATED LINKS
108142
109143
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

0 commit comments

Comments
 (0)