{"id":2511,"date":"2022-03-20T14:40:30","date_gmt":"2022-03-20T19:40:30","guid":{"rendered":"https:\/\/www.ciraltos.com\/?p=2511"},"modified":"2023-03-23T05:20:36","modified_gmt":"2023-03-23T10:20:36","slug":"use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine","status":"publish","type":"post","link":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/","title":{"rendered":"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine"},"content":{"rendered":"\n<figure class=\"wp-block-image alignleft size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"200\" height=\"200\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2022\/03\/PSSnapImage.png\" alt=\"PowerShell Image Snapshot\" class=\"wp-image-2512\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2022\/03\/PSSnapImage.png 200w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2022\/03\/PSSnapImage-150x150.png 150w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/figure>\n\n\n\n<p>This video goes of using the SnapImage.ps1 PowerShell script.&nbsp; This script automates the process of creating an image from an Azure VM without destroying it during the capture process.&nbsp; At a high-level, the following steps are taken: <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Snapshot of source &#8220;reference&#8221; VM &gt; create a\ntemp &#8220;capture&#8221; Resource Group &gt; OS disk from snapshot &gt; create\na VNet and VM in the capture RG &gt; sysprep the VM with a Custom Script\nExtension &gt; capture the VM &gt; If using Azure Compute Gallery, add image to\nthe gallery, If not using Azure Compute Gallery, add image to reference VM\nResource Group &gt; remove capture Resource Group &gt; remove snapshot<\/p>\n\n\n\n<p>Please read the description and notes in the script before running.&nbsp; If the script hangs on the sysprep step, verify the reference computer is ready for sysprep including all updates are applied or automatic updates are disabled, and there are no per-user Microsoft store applications installed.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container\" style=\"height: 100%;\"><iframe loading=\"lazy\" title=\"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/H3UrVsI9f7s?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<h2>Links<\/h2>\n\n\n\n<p>Zero to Hero with Azure Virtual Desktop <a href=\"https:\/\/www.udemy.com\/course\/zero-to-hero-with-windows-virtual-desktop\/?referralCode=B2FE49E6FCEE7A7EA8D4\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"https:\/\/www.udemy.com\/course\/zero-to-hero-with-windows-virtual-desktop\/?referralCode=B2FE49E6FCEE7A7EA8D4 (opens in a new tab)\">https:\/\/www.udemy.com\/course\/zero-to-hero-with-windows-virtual-desktop\/?referralCode=B2FE49E6FCEE7A7EA8D4<\/a><\/p>\n\n\n\n<p>Image Builder Playlist<br><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/youtube.com\/playlist?list=PLnWpsLZNgHzWeiHA_wG0xuaZMlk1Nag7E\" target=\"_blank\">https:\/\/youtube.com\/playlist?list=PLnWpsLZNgHzWeiHA_wG0xuaZMlk1Nag7E<\/a><\/p>\n\n\n\n<p>GitHub Repo <a rel=\"noreferrer noopener\" aria-label=\"https:\/\/github.com\/tsrob50\/WVD-Public (opens in a new tab)\" href=\"https:\/\/github.com\/tsrob50\/WVD-Public\" target=\"_blank\">https:\/\/github.com\/tsrob50\/WVD-Public<\/a><br>SnapImage.ps1 <a href=\"https:\/\/github.com\/tsrob50\/WVD-Public\/blob\/master\/SnapImage.ps1\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"https:\/\/github.com\/tsrob50\/WVD-Public\/blob\/master\/SnapImage.ps1 (opens in a new tab)\">https:\/\/github.com\/tsrob50\/WVD-Public\/blob\/master\/SnapImage.ps1<\/a><br>SysprepCSE.ps1 <a rel=\"noreferrer noopener\" aria-label=\"https:\/\/raw.githubusercontent.com\/tsrob50\/WVD-Public\/master\/SysprepCSE.ps1 (opens in a new tab)\" href=\"https:\/\/raw.githubusercontent.com\/tsrob50\/WVD-Public\/master\/SysprepCSE.ps1\" target=\"_blank\">https:\/\/raw.githubusercontent.com\/tsrob50\/WVD-Public\/master\/SysprepCSE.ps1<\/a><\/p>\n\n\n\n<p>Sysprep fails after remove Microsoft Store Apps<br><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/troubleshoot\/windows-client\/deployment\/sysprep-fails-remove-or-update-store-apps\" target=\"_blank\">https:\/\/docs.microsoft.com\/en-us\/troubleshoot\/windows-client\/deployment\/sysprep-fails-remove-or-update-store-apps<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This video goes of using the SnapImage.ps1 PowerShell script.&nbsp; This script automates the process of creating an image from an Azure VM without destroying it during the capture process.&nbsp; At a high-level, the following steps are taken:<\/p>\n","protected":false},"author":1,"featured_media":2512,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[2,391],"tags":[454,230,1043,9,1242,1047,1245,1243,1244,120,1247,1241,20,187,68,568,872,1246,27,26,213],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine - ciraltos<\/title>\n<meta name=\"description\" content=\"This video goes of using a script automates the process of creating an image from an Azure VM without destroying it during the capture process.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine - ciraltos\" \/>\n<meta property=\"og:description\" content=\"This video goes of using a script automates the process of creating an image from an Azure VM without destroying it during the capture process.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\" \/>\n<meta property=\"og:site_name\" content=\"ciraltos\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-20T19:40:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-23T10:20:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2022\/03\/PSSnapImage.png\" \/>\n\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Travis Roberts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:site\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Roberts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\"},\"author\":{\"name\":\"Travis Roberts\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"headline\":\"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine\",\"datePublished\":\"2022-03-20T19:40:30+00:00\",\"dateModified\":\"2023-03-23T10:20:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\"},\"wordCount\":259,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"keywords\":[\"automate\",\"Automation\",\"AVD\",\"Azure\",\"Azure Compute Gallery\",\"Azure Virtual Desktop\",\"capture\",\"CSE\",\"Custom Script Extension\",\"image\",\"Image Gallery\",\"OS Disk\",\"Powershell\",\"resource group\",\"script\",\"Snapshot\",\"Sysprep\",\"Sysprep.exe\",\"virtual machine\",\"VM\",\"VNet\"],\"articleSection\":[\"Azure\",\"Windows Virtual Desktop\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\",\"name\":\"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine - ciraltos\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\"},\"datePublished\":\"2022-03-20T19:40:30+00:00\",\"dateModified\":\"2023-03-23T10:20:36+00:00\",\"description\":\"This video goes of using a script automates the process of creating an image from an Azure VM without destroying it during the capture process.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.ciraltos.com\/staging2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/\",\"name\":\"ciraltos\",\"description\":\"cloud, technology and trends\",\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\",\"name\":\"Travis Roberts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"contentUrl\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"width\":5657,\"height\":3563,\"caption\":\"Travis Roberts\"},\"logo\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.ciraltos.com\",\"https:\/\/twitter.com\/ciraltos\"],\"url\":\"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine - ciraltos","description":"This video goes of using a script automates the process of creating an image from an Azure VM without destroying it during the capture process.","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:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/","og_locale":"en_US","og_type":"article","og_title":"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine - ciraltos","og_description":"This video goes of using a script automates the process of creating an image from an Azure VM without destroying it during the capture process.","og_url":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/","og_site_name":"ciraltos","article_published_time":"2022-03-20T19:40:30+00:00","article_modified_time":"2023-03-23T10:20:36+00:00","og_image":[{"width":200,"height":200,"url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2022\/03\/PSSnapImage.png","type":"image\/png"}],"author":"Travis Roberts","twitter_card":"summary_large_image","twitter_creator":"@ciraltos","twitter_site":"@ciraltos","twitter_misc":{"Written by":"Travis Roberts","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#article","isPartOf":{"@id":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/"},"author":{"name":"Travis Roberts","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"headline":"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine","datePublished":"2022-03-20T19:40:30+00:00","dateModified":"2023-03-23T10:20:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/"},"wordCount":259,"commentCount":0,"publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"keywords":["automate","Automation","AVD","Azure","Azure Compute Gallery","Azure Virtual Desktop","capture","CSE","Custom Script Extension","image","Image Gallery","OS Disk","Powershell","resource group","script","Snapshot","Sysprep","Sysprep.exe","virtual machine","VM","VNet"],"articleSection":["Azure","Windows Virtual Desktop"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/","url":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/","name":"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine - ciraltos","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#website"},"datePublished":"2022-03-20T19:40:30+00:00","dateModified":"2023-03-23T10:20:36+00:00","description":"This video goes of using a script automates the process of creating an image from an Azure VM without destroying it during the capture process.","breadcrumb":{"@id":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ciraltos.com\/staging2\/use-powershell-to-create-a-snapshot-based-image-of-an-azure-virtual-machine\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.ciraltos.com\/staging2\/"},{"@type":"ListItem","position":2,"name":"Use PowerShell to Create a Snapshot Based Image of an Azure Virtual Machine"}]},{"@type":"WebSite","@id":"http:\/\/www.ciraltos.com\/staging2\/#website","url":"http:\/\/www.ciraltos.com\/staging2\/","name":"ciraltos","description":"cloud, technology and trends","publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a","name":"Travis Roberts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/","url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","contentUrl":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","width":5657,"height":3563,"caption":"Travis Roberts"},"logo":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.ciraltos.com","https:\/\/twitter.com\/ciraltos"],"url":"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/2511"}],"collection":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/comments?post=2511"}],"version-history":[{"count":4,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/2511\/revisions"}],"predecessor-version":[{"id":3780,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/2511\/revisions\/3780"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media\/2512"}],"wp:attachment":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media?parent=2511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/categories?post=2511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/tags?post=2511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}