You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @iloving. Nice find that this doesn't work. I've added support for using -ErrorAction:Stop to all PnP cmdlets in PR #2288. Notice though that not all PnP PowerShell cmdlets are set up in a way that they will deal with this properly yet, but a lot of them will, including Add-PnPGroupMember.
Hi, this has been merged and will be available in the latest nightly from tomorrow onwards !
Thanks for raising this issue and thanks @KoenZomers for fixing it.
I have the following statement:
Add-PnPGroupMember -Group "$groupName" -LoginName "$memberToAdd" -Connection $Connection -ErrorAction Stop
While testing my script, sharepoint failed during the execution of this statement. My script should have subsequently aborted, and it didn't.
Expected behavior
The script should have stopped executing
Actual behavior
Add-PnPGroupMember: /PATH/TO/MY/SCRIPT.ps1:500:5
Line |
500 | Add-PnPGroupMember -Group "$groupName" -LoginName "$memberToAdd" …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| User cannot be found.
and then kept running.
Steps to reproduce behavior
Do whatever it takes to make the cmdlet throw an error, such as using an non-existent user or group.
What is the version of the Cmdlet module you are running?
1.10
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: