microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
695 stars 168 forks source link

Extend -WhatIf parameter #877

Closed maisarissi closed 1 year ago

maisarissi commented 3 years ago

Add –WhatIf parameter so users can see what request will be sent to the service without actually sending it.

This effort includes, but may not be limited to just these tasks:

KevinMarquette commented 3 years ago

I just want to add that -WhatIf support is a native feature of PowerShell. It is really helpful for admins learning the commands or doing a dry run before making changes. I have detailed guidance on how to implement it here https://powershellexplained.com/2020-03-15-Powershell-shouldprocess-whatif-confirm-shouldcontinue-everything

MarkDordoy commented 2 years ago

I noticed New-MgGroupMember has the -whatif flag and it works if you handle it directly, however it did not pick up the script $whatifpreference = $true value which is bad. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#whatifpreference

peombwa commented 2 years ago

-WhatIf parameter is already supported on all commands that make changes as stated in https://devblogs.microsoft.com/scripting/weekend-scripter-easily-add-whatif-support-to-your-powershell-functions/. Use Get-Command *-Mg* | where { $_.parameters.keys -Contains "WhatIf" } to see commands that currently supports -WhatIf.

This feature request should:

ddyett commented 2 years ago

looking at using a directive to address for V2.

peombwa commented 1 year ago

Closed by #1651