{"id":1530,"date":"2015-02-05T08:56:00","date_gmt":"2015-02-05T08:56:00","guid":{"rendered":"https:\/\/evren.info\/google-workspace-de-takma-adlari-alias-listeleme-ve-silme\/"},"modified":"2025-09-10T06:46:56","modified_gmt":"2025-09-10T06:46:56","slug":"google-workspace-de-takma-adlari-alias-listeleme-ve-silme","status":"publish","type":"post","link":"https:\/\/evren.info\/en\/google-workspace-de-takma-adlari-alias-listeleme-ve-silme\/","title":{"rendered":"Google WorkSpace list and delete aliases"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Script code to find out who among your users in your Google WorkSpace systems is using an alias:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just go to script.google.com and run the code below. That&#8217;s it. \ud83d\ude42<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"577\" src=\"https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-1024x577.png\" alt=\"\" class=\"wp-image-1526\" srcset=\"https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-1024x577.png 1024w, https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-300x169.png 300w, https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-768x433.png 768w, https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-1536x866.png 1536w, https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-150x85.png 150w, https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11-600x338.png 600w, https:\/\/evren.info\/wp-content\/uploads\/2025\/09\/alias11.png 1912w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>function listUsersWithEmailAliases() {\nlet pageToken\nlet page\ndo {\npage = AdminDirectory.Users.list({\ncustomer: 'my_customer',\nmaxResults: 100,\npageToken,\nfields: 'users(name\/fullName,primaryEmail,aliases),nextPageToken',\n})\nlet users = page.users\nif (users) {\nfor (let i = 0; i &lt; users.length; i++) {\nconst user = users&#91;i]\nif (user.aliases &amp;&amp; user.aliases.length &gt; 0) {\nLogger.log(`User ${user.name.fullName} &lt;${user.primaryEmail}&gt; `\n+ `has ${user.aliases.length} email alias${user.aliases.length &gt; 1 ? 'es' : ''}: `\n+ JSON.stringify(user.aliases))\n}\n}\n} else {\nLogger.log('No users found.')\n}\npageToken = page.nextPageToken\n} while (pageToken)\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can then use the following GAM to bulk delete these aliases<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gam redirect csv .\/OldDomainAliases.csv print aliases aliasmatchpattern \".*@olddomain.com\" onerowpertarget suppressnoaliasrows\ngam redirect stdout .\/DeleteAliases.txt multiprocess redirect stderr stdout csv .\/OldDomainAliases.csv gam remove aliases \"~Target\" \"~TargetType\" \"~Aliases\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/taers232c\/GAMADV-XTD3\/wiki\/Aliases#remove-aliases-from-a-specified-target\">https:\/\/github.com\/taers232c\/GAMADV-XTD3\/wiki\/Aliases#remove-aliases-from-a-specified-target<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Script code to find out who among your users in your Google WorkSpace systems is using an alias: Just go to script.google.com and run the code below. That&#8217;s it. \ud83d\ude42 You can then use the following GAM to bulk delete these aliases https:\/\/github.com\/taers232c\/GAMADV-XTD3\/wiki\/Aliases#remove-aliases-from-a-specified-target<\/p>\n","protected":false},"author":1,"featured_media":1527,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/posts\/1530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/comments?post=1530"}],"version-history":[{"count":3,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/posts\/1530\/revisions"}],"predecessor-version":[{"id":1534,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/posts\/1530\/revisions\/1534"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/media\/1527"}],"wp:attachment":[{"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/media?parent=1530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/categories?post=1530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/evren.info\/en\/wp-json\/wp\/v2\/tags?post=1530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}