need help renaming distribution list names
i don't know if possible, above skill level. we have 400 or distribution lists created already.
it has been decided prefix needs changed on each distribution list. so lets 3 examples are
"contoso human resources"
"contoso engineering"
"contoso it"
is there way script change name "contoso" in each dl? so in end have
"newco human resources"
"newco engineering"
"newco it"
we hoping not recreate each dl, or have manually rename each one.
thanks!!
string replacement simplest:
get-distributiongroup -filter "name -like 'contoso *'" | foreach { $newname = $_.name.replace('contoso','newco') $newdisplayname = $_.displayname.replace('contoso','newco') write-host "new name $newname" -foregroundcolor green write-host "new display name $newdisplayname" -foregroundcolor red }
Windows Server > Windows PowerShell
Comments
Post a Comment