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

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Domain migration ERR3:7075 Failed to change domain affiliation, hr=8007054a This operation is only allowed for the Primary Domain Controller of the domain

How do a find data in one file, search for it in another file and if not found, write a custom message to another file