Set-AdUser doesn't work when 'Instance' and 'WhatIf' are used at the same time
When you use the Set-AdUser cmdlet with the -Instance parameter throws an error if you also use -WhatIf
 PS G:> $User = Get-ADUser -Identity joshuak
 PS G:> $User.GivenName = 'Josh'
 PS G:> Set-ADUser -Instance $User -WhatIf
What if: Performing the operation "Set" on target "CN=Joshua King,OU=staff,OU=users,DC=example,DC=co,DC=nz".
Set-ADUser : One of the following parameters is required 'Identity,Instance'.
At line:1 char:1
+ Set-ADUser -Instance $User -WhatIf
+ CategoryInfo : InvalidArgument: (:) [Set-ADUser], ArgumentException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Commands.SetADUser
Jake Moe commented
I just spent the last half hour trying to figure out why this wasn't working. Glad to see I wasn't doing it wrong. This is happening for me on Windows 10, PowerShell version 5.1.14393.206, using ActiveDirectory module from WindowsTH-RSAT_WS2016-x64.msu.
Chris Salzgeber commented
I'm looking to fix this and other issues on my separate UserVoice thread found here: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/13350033-open-source-the-activedirectory-powershell-module
Joshua (Windos) King commented
* This was on PSVersion 5.0.10586.122
* Confirm works as expected.