I am following this guide
I was able to export the Distribution Groups to a CSV, and edit the CSV, but when using
Import-csv c:\displayname.csv | foreach-object {set-adgroup -identity $_.SamAccountName -displayname $_.displayname}
To import the modifications, I get:
Set-ADGroup : Cannot validate argument on parameter ‘Identity’. The
argument is null. Supply a non-null argument and try the command again.
I have tried variations on the theme and no change. Also, I needed to use -Credential domain\username when exporting, I have tried adding that and variations of that when trying to import the changes back…no difference.
1) Wouldn’t I need to authenticate?
2) What am I missing as far as importing the CSV? I feel it is simple, like some extra info: OU, DC, Credential etc.
Your error just indicate that
$_.SamAccountNameis not valued do you try first to see these values ?Modifying the CSV file you perhaps corrupt it, your command line works for me.
Perhaps your problem is in the encoding or in the form of your CSV file you can try first to create one with PowerShell :
And then to compare with your own. Here I just extract a few fields from groups containing sec in their names.