{"id":422,"date":"2024-04-08T14:46:41","date_gmt":"2024-04-08T12:46:41","guid":{"rendered":"https:\/\/blog.bardalen.no\/?p=422"},"modified":"2024-04-08T14:46:45","modified_gmt":"2024-04-08T12:46:45","slug":"create-teams-and-channels-in-bulk","status":"publish","type":"post","link":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/","title":{"rendered":"Create teams and channels in bulk"},"content":{"rendered":"\n<p>Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Had to do a project lately with a lot of teams and channels that needed to be created in a way that minimizes errors and potential screw-ups. Since I&#8217;m all for automating these kinds of tasks, I created this project that I want to share with you!<\/p>\n\n\n\n<p><strong>You do need some prerequisites:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Some knowledge of both PowerShell and JSON<\/li>\n\n\n\n<li>The Teams-module <a href=\"https:\/\/learn.microsoft.com\/en-us\/microsoftteams\/teams-powershell-install\">installed on your computer<\/a><\/li>\n\n\n\n<li>Rights to a tenant to create teams<\/li>\n\n\n\n<li>Some teams and channels that needs to be created!<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Create the JSON-file<\/h2>\n\n\n\n<p>First, you need a source for what structure you want to generate. This is my template JSON-file:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#33384d;color:#aaafcf\">JSON<\/span><span role=\"button\" tabindex=\"0\" data-code=\"[\n  {\n    &quot;TeamName&quot;: &quot;Team1&quot;,\n    &quot;Channels&quot;: [\n      {\n        &quot;ChannelName&quot;: &quot;Channel1&quot;,\n        &quot;MembershipType&quot;: &quot;Private&quot;\n      },\n      {\n        &quot;ChannelName&quot;: &quot;Channel2&quot;,\n        &quot;MembershipType&quot;: &quot;Standard&quot;\n      }\n    ]\n  },\n  {\n    &quot;TeamName&quot;: &quot;Team2&quot;,\n    &quot;Channels&quot;: [\n      {\n        &quot;ChannelName&quot;: &quot;Channel3&quot;,\n        &quot;MembershipType&quot;: &quot;Private&quot;\n      },\n      {\n        &quot;ChannelName&quot;: &quot;Channel4&quot;,\n        &quot;MembershipType&quot;: &quot;Standard&quot;\n      }\n    ]\n  }\n]\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #89DDFF\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">  <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C792EA\">TeamName<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Team1<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C792EA\">Channels<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">ChannelName<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Channel1<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">MembershipType<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Private<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">ChannelName<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Channel2<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">MembershipType<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Standard<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">  <\/span><span style=\"color: #89DDFF\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">  <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C792EA\">TeamName<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Team2<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C792EA\">Channels<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">ChannelName<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Channel3<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">MembershipType<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Private<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">ChannelName<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Channel4<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #FFCB6B\">MembershipType<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">:<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Standard<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">      <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">  <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Let me explain the structure. First we define what teams we need to be created. They are in the first level in the JSON-file. Under each team there is an array with all the channels belonging to that team. <em>Note: this is in addition to the General-channel all teams must have. <\/em><\/p>\n\n\n\n<p>Each channel must have a name, and a defined membership type. The types I use here are &laquo;Standard&raquo; and &laquo;Private&raquo;. You can also create &laquo;Shared&raquo;, but I will not cover it at this point.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The PowerShell script<\/h2>\n\n\n\n<p>First, we begin with the besics of settings things up. We define the root folder from where you run the script and where everything resides. I know there are ways to do this in a more slick way. Maybe in a future version this will be more dynamic?<\/p>\n\n\n\n<p>We point to the JSON file, read out the JSON file and converts the content from JSON to something PowerShell can read into a variable we later read out from. <\/p>\n\n\n\n<p>Then we get some timestamps defined and sets up a log file to write to. Yeah, we log every bit to a file so you later can document what has happened!<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#33384d;color:#aaafcf\">PowerShell<\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Read the JSON file\n$rootFolder = &quot;C:\\data\\&quot;\n$jsonFile = &quot;Teams-and-Channels.json&quot;\n$jsonData = Get-Content $jsonFile | ConvertFrom-Json\n$timestamp = (Get-Date).toString(&quot;yyyyMMddHHmm&quot;)\n$logFileName = &quot;Log_&quot; + $timestamp + &quot;.txt&quot;\n$logFileAndPath = $rootFolder + $logFileName\n\nNew-Item -Path $rootFolder -Name $logFileName -type file\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #676E95; font-style: italic\"># Read the JSON file<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">rootFolder <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">C:\\data\\<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">jsonFile <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Teams-and-Channels.json<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">jsonData <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #82AAFF\">Get-Content<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">jsonFile <\/span><span style=\"color: #89DDFF\">|<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #82AAFF\">ConvertFrom-Json<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">timestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMddHHmm<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileName <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Log_<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">+<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">timestamp <\/span><span style=\"color: #89DDFF\">+<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">.txt<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileAndPath <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">rootFolder <\/span><span style=\"color: #89DDFF\">+<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileName<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #82AAFF\">New-Item<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Path <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">rootFolder <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Name <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileName <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">type file<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The next part tries to connect to Teams. And of course logs the results, even if it fails. Remember to use a user that has access to create Teams!<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#33384d;color:#aaafcf\">PowerShell<\/span><span role=\"button\" tabindex=\"0\" data-code=\"try {\n\t\tConnect-MicrosoftTeams\n\t\t$messageTimestamp = (Get-Date).toString(&quot;yyyyMMdd-HH:mm:ss&quot;)\n\t\t$message = &quot;Successfully connected to  Microsoft Teams!&quot;\n\t\tWrite-Host $messageTimestamp - $message\n\t} catch {\n\t\t$messageTimestamp = (Get-Date).toString(&quot;yyyyMMdd-HH:mm:ss&quot;)\n\t\t$message = &quot;Could not connect to  Microsoft Teams!&quot;\n\t\tWrite-Host $messageTimestamp - $message\n\t}\n\t\nAdd-Content -Path $logFileAndPath -Value &quot;$messageTimestamp - $message&quot;\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #89DDFF; font-style: italic\">try<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #82AAFF\">Connect-MicrosoftTeams<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMdd-HH:mm:ss<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Successfully connected to  Microsoft Teams!<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><span style=\"color: #89DDFF\">}<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF; font-style: italic\">catch<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMdd-HH:mm:ss<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Could not connect to  Microsoft Teams!<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><\/span>\n<span class=\"line\"><span style=\"color: #82AAFF\">Add-Content<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Path <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileAndPath <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Value <\/span><span style=\"color: #89DDFF\">&quot;$<\/span><span style=\"color: #BABED8\">messageTimestamp<\/span><span style=\"color: #C3E88D\"> - <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The script goes through every bit in the now converted JSON data in the foreach-loop and creates a team. For every team you have defined, it reads the name and looks up if there&#8217;s a team with that name already. If that name is taken, it will throw an error about that. But! It will create channels in that team later on in the script!<\/p>\n\n\n\n<p>When a team is created it will be created as a private team with a default description of &laquo;Team created via PowerShell&raquo;. <em>Something we can customize in a later version?<\/em><\/p>\n\n\n\n<p>After each team is created we wait 20 seconds. This is for the team to be properly created in the cloud before we can add channels.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#33384d;color:#aaafcf\">PowerShell<\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Iterate through each team in the JSON file\nforeach ($teamData in $jsonData) {\n    $teamName = $teamData.TeamName\n\n    # Create Team if not already exists\n    if (-not (Get-Team -DisplayName $teamName)) {\n        New-Team -DisplayName $teamName -Description &quot;Team created via PowerShell&quot;\n\t\t$messageTimestamp = (Get-Date).toString(&quot;yyyyMMdd-HH:mm:ss&quot;)\n\t\t$message = &quot;Created Team: &quot; + $teamName\n        Write-Host $messageTimestamp - $message\n\t\tAdd-Content -Path $logFileAndPath -Value &quot;$messageTimestamp - $message&quot;\n    }\n\t\n\t#Wait for the team to be created before adding channels\n\tWrite-Host &quot;Waiting 20 seconds for the team to be properly created...&quot;\n\tStart-Sleep -Seconds 20\n\tWrite-Host &quot;The wait is over. Continuing with the channels&quot;\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #676E95; font-style: italic\"># Iterate through each team in the JSON file<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF; font-style: italic\">foreach<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">($<\/span><span style=\"color: #BABED8\">teamData <\/span><span style=\"color: #89DDFF; font-style: italic\">in<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">jsonData<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamName <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamData.TeamName<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #676E95; font-style: italic\"># Create Team if not already exists<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF; font-style: italic\">if<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(-not<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Team<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">DisplayName <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamName<\/span><span style=\"color: #89DDFF\">))<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #82AAFF\">New-Team<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">DisplayName <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamName <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Description <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Team created via PowerShell<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMdd-HH:mm:ss<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Created Team: <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">+<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamName<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #82AAFF\">Add-Content<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Path <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileAndPath <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Value <\/span><span style=\"color: #89DDFF\">&quot;$<\/span><span style=\"color: #BABED8\">messageTimestamp<\/span><span style=\"color: #C3E88D\"> - <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><span style=\"color: #676E95; font-style: italic\">#Wait for the team to be created before adding channels<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Waiting 20 seconds for the team to be properly created...<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><span style=\"color: #82AAFF\">Start-Sleep<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Seconds <\/span><span style=\"color: #F78C6C\">20<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t<\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">The wait is over. Continuing with the channels<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Another foreach loop is used to loop through the channels defined in the JSON file. If a channels does exist it will skip it and gop to the next. The result is of course logged to file.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#33384d;color:#aaafcf\">PowerShell<\/span><span role=\"button\" tabindex=\"0\" data-code=\"foreach ($channelData in $teamData.Channels) {\n        $channelName = $channelData.ChannelName\n        $membershipType = $channelData.MembershipType\n\n        # Check if channel already exists and creates it\n        try {\n            New-TeamChannel -GroupId $teamId -DisplayName $channelName -Description &quot;Channel created via PowerShell&quot; -MembershipType $membershipType\n\t\t\t$messageTimestamp = (Get-Date).toString(&quot;yyyyMMdd-HH:mm:ss&quot;)\n\t\t\t$message = &quot;Created channel: &quot; + $channelName\n\t\t\tWrite-Host $messageTimestamp - $message           \n        } catch {\n\t\t\t$messageTimestamp = (Get-Date).toString(&quot;yyyyMMdd-HH:mm:ss&quot;)\n\t\t\t$message = &quot;Could not create channel. Already exists?: &quot; + $channelName\n            Write-Host $messageTimestamp - $message\n        }\n\t\tAdd-Content -Path $logFileAndPath -Value &quot;$messageTimestamp - $message&quot;\n    }\n}\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #89DDFF; font-style: italic\">foreach<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">($<\/span><span style=\"color: #BABED8\">channelData <\/span><span style=\"color: #89DDFF; font-style: italic\">in<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamData.Channels<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">channelName <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">channelData.ChannelName<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">membershipType <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">channelData.MembershipType<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #676E95; font-style: italic\"># Check if channel already exists and creates it<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF; font-style: italic\">try<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">            <\/span><span style=\"color: #82AAFF\">New-TeamChannel<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">GroupId <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">teamId <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">DisplayName <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">channelName <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Description <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Channel created via PowerShell<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">MembershipType <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">membershipType<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMdd-HH:mm:ss<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Created channel: <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">+<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">channelName<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t\t<\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message           <\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">}<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF; font-style: italic\">catch<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMdd-HH:mm:ss<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t\t<\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Could not create channel. Already exists?: <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">+<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">channelName<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">            <\/span><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">        <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">\t\t<\/span><span style=\"color: #82AAFF\">Add-Content<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Path <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileAndPath <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Value <\/span><span style=\"color: #89DDFF\">&quot;$<\/span><span style=\"color: #BABED8\">messageTimestamp<\/span><span style=\"color: #C3E88D\"> - <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">    <\/span><span style=\"color: #89DDFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Lastly we disconnect from Teams:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#33384d;color:#aaafcf\">PowerShell<\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Disconnect from Microsoft Teams\nDisconnect-MicrosoftTeams\n$messageTimestamp = (Get-Date).toString(&quot;yyyyMMdd-HH:mm:ss&quot;)\n$message = &quot;Disconnected from Microsoft Teams!&quot;\nWrite-Host $messageTimestamp - $message\nAdd-Content -Path $logFileAndPath -Value &quot;$messageTimestamp - $message&quot;\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #676E95; font-style: italic\"># Disconnect from Microsoft Teams<\/span><\/span>\n<span class=\"line\"><span style=\"color: #82AAFF\">Disconnect-MicrosoftTeams<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #82AAFF\">Get-Date<\/span><span style=\"color: #89DDFF\">)<\/span><span style=\"color: #BABED8\">.toString<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">yyyyMMdd-HH:mm:ss<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">Disconnected from Microsoft Teams!<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #82AAFF\">Write-Host<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">messageTimestamp <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><\/span>\n<span class=\"line\"><span style=\"color: #82AAFF\">Add-Content<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Path <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">logFileAndPath <\/span><span style=\"color: #89DDFF\">-<\/span><span style=\"color: #BABED8\">Value <\/span><span style=\"color: #89DDFF\">&quot;$<\/span><span style=\"color: #BABED8\">messageTimestamp<\/span><span style=\"color: #C3E88D\"> - <\/span><span style=\"color: #89DDFF\">$<\/span><span style=\"color: #BABED8\">message<\/span><span style=\"color: #89DDFF\">&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The script is tested in controlled environments. Some parts are quite rudimentary but does the job. Besides, I&#8217;m not fluent in PowerShell so this is a great way for me to practise!<\/p>\n\n\n\n<p>Links to my GitHub where this project is located:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/Bangdalen\/PS-MS365-Tools\/tree\/master\/Generate-TeamsAndChannels\">https:\/\/github.com\/Bangdalen\/PS-MS365-Tools\/tree\/master\/Generate-TeamsAndChannels<\/a><\/p>\n\n\n\n<p>Feel free to either contribute or point out my mistakes \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Had to do a project lately with a lot of teams and channels that needed to be created in a way that minimizes errors and potential screw-ups. Since I&#8217;m all for automating these kinds of tasks, I created this project that I want to share with you! You do need some prerequisites: Create the JSON-file First, you need a source for what structure you&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\">Les mer<span class=\"screen-reader-text\"> Les mer<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":429,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,52],"tags":[],"class_list":["post-422","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","category-teams"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create teams and channels in bulk - Blog.bardalen.no<\/title>\n<meta name=\"description\" content=\"Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Let&#039;s generate them with ease\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\" \/>\n<meta property=\"og:locale\" content=\"nb_NO\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create teams and channels in bulk - Blog.bardalen.no\" \/>\n<meta property=\"og:description\" content=\"Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Let&#039;s generate them with ease\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog.bardalen.no\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-08T12:46:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-08T12:46:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tony Bardalen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Skrevet av\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tony Bardalen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Ansl. lesetid\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutter\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\"},\"author\":{\"name\":\"Tony Bardalen\",\"@id\":\"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a\"},\"headline\":\"Create teams and channels in bulk\",\"datePublished\":\"2024-04-08T12:46:41+00:00\",\"dateModified\":\"2024-04-08T12:46:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\"},\"wordCount\":581,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a\"},\"image\":{\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg\",\"articleSection\":[\"PowerShell\",\"Teams\"],\"inLanguage\":\"nb-NO\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\",\"url\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\",\"name\":\"Create teams and channels in bulk - Blog.bardalen.no\",\"isPartOf\":{\"@id\":\"https:\/\/blog.bardalen.no\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg\",\"datePublished\":\"2024-04-08T12:46:41+00:00\",\"dateModified\":\"2024-04-08T12:46:45+00:00\",\"description\":\"Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Let's generate them with ease\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#breadcrumb\"},\"inLanguage\":\"nb-NO\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"nb-NO\",\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage\",\"url\":\"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg\",\"contentUrl\":\"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hjem\",\"item\":\"https:\/\/blog.bardalen.no\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create teams and channels in bulk\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.bardalen.no\/#website\",\"url\":\"https:\/\/blog.bardalen.no\/\",\"name\":\"Blog.bardalen.no\",\"description\":\"A blog about cloudy stuff\",\"publisher\":{\"@id\":\"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.bardalen.no\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"nb-NO\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a\",\"name\":\"Tony Bardalen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nb-NO\",\"@id\":\"https:\/\/blog.bardalen.no\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/433273fdcc418ba1a5101686ae0fa85fc15baf53a2bafc63eb84bce1911caa0e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/433273fdcc418ba1a5101686ae0fa85fc15baf53a2bafc63eb84bce1911caa0e?s=96&d=mm&r=g\",\"caption\":\"Tony Bardalen\"},\"logo\":{\"@id\":\"https:\/\/blog.bardalen.no\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create teams and channels in bulk - Blog.bardalen.no","description":"Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Let's generate them with ease","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/","og_locale":"nb_NO","og_type":"article","og_title":"Create teams and channels in bulk - Blog.bardalen.no","og_description":"Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Let's generate them with ease","og_url":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/","og_site_name":"Blog.bardalen.no","article_published_time":"2024-04-08T12:46:41+00:00","article_modified_time":"2024-04-08T12:46:45+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg","type":"image\/jpeg"}],"author":"Tony Bardalen","twitter_card":"summary_large_image","twitter_misc":{"Skrevet av":"Tony Bardalen","Ansl. lesetid":"4 minutter"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#article","isPartOf":{"@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/"},"author":{"name":"Tony Bardalen","@id":"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a"},"headline":"Create teams and channels in bulk","datePublished":"2024-04-08T12:46:41+00:00","dateModified":"2024-04-08T12:46:45+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/"},"wordCount":581,"commentCount":0,"publisher":{"@id":"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a"},"image":{"@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg","articleSection":["PowerShell","Teams"],"inLanguage":"nb-NO","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/","url":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/","name":"Create teams and channels in bulk - Blog.bardalen.no","isPartOf":{"@id":"https:\/\/blog.bardalen.no\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage"},"image":{"@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg","datePublished":"2024-04-08T12:46:41+00:00","dateModified":"2024-04-08T12:46:45+00:00","description":"Thanks to the magic of PowerShell and JSON, we can add teams and channels in bulk! Let's generate them with ease","breadcrumb":{"@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#breadcrumb"},"inLanguage":"nb-NO","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/"]}]},{"@type":"ImageObject","inLanguage":"nb-NO","@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#primaryimage","url":"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg","contentUrl":"https:\/\/blog.bardalen.no\/wp-content\/uploads\/2024\/04\/Designer_hacking_scripting.jpeg","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/blog.bardalen.no\/index.php\/2024\/04\/08\/create-teams-and-channels-in-bulk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hjem","item":"https:\/\/blog.bardalen.no\/"},{"@type":"ListItem","position":2,"name":"Create teams and channels in bulk"}]},{"@type":"WebSite","@id":"https:\/\/blog.bardalen.no\/#website","url":"https:\/\/blog.bardalen.no\/","name":"Blog.bardalen.no","description":"A blog about cloudy stuff","publisher":{"@id":"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.bardalen.no\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"nb-NO"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.bardalen.no\/#\/schema\/person\/824afefe68762a6905723a53c0f28f9a","name":"Tony Bardalen","image":{"@type":"ImageObject","inLanguage":"nb-NO","@id":"https:\/\/blog.bardalen.no\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/433273fdcc418ba1a5101686ae0fa85fc15baf53a2bafc63eb84bce1911caa0e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/433273fdcc418ba1a5101686ae0fa85fc15baf53a2bafc63eb84bce1911caa0e?s=96&d=mm&r=g","caption":"Tony Bardalen"},"logo":{"@id":"https:\/\/blog.bardalen.no\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/posts\/422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/comments?post=422"}],"version-history":[{"count":6,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/posts\/422\/revisions"}],"predecessor-version":[{"id":428,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/posts\/422\/revisions\/428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/media\/429"}],"wp:attachment":[{"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/media?parent=422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/categories?post=422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bardalen.no\/index.php\/wp-json\/wp\/v2\/tags?post=422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}