You will not get banned for either generating invite key or sharing it with strangers, But if someone you have invited violates rules and regulations and gets banned You will also get Banned.