This project is read-only.

Consider allowing the caller to pass empty value to New-FimImportObject

Jun 13, 2016 at 11:49 PM
Per my blog post:

In the latest version of the FIM Powershell Module (2016-05-18), in order to remove/unset/clear a single-valued reference attribute, you're supposed to do this:
New-FimImportChange -Operation 'Replace' -AttributeName "Manager"
Note that you just don't supply the -AttributeValue paramter. However, in my script, I don't want to perform the extra step of checking whether my value is present; so I'd like to do this:
New-FimImportChange -Operation 'Replace' -AttributeName "Manager" -AttributeValue "$newManager"
In order to do that, I had to make a small change to New-FimImportChange in FimPowerShellModule.psm1:
### Process the AttributeValue Parameter
if (!$AttributeValue)
    # Allow the caller to pass an empty AttributeValue to unset it, but DO NOT set the AttributeValue on the ImportChange object.
elseif ($AttributeValue -is [String])
    $importChange.AttributeValue = $AttributeValue
elseif ($AttributeValue -is [DateTime])