is is possible to modify dynamic group rules using powershell ?

We have around 600 dynamic groups based on leaders in the company. We need to modify the  rule to include only regular employee. Is there a way to do this via powershell scripts? We already test it in a few groups, but looking to modify all of them via sometype of script. 

We are not familiar with the process of doing this

Have anybody done this before?

Thanks