{"id":73081,"date":"2015-09-28T00:01:00","date_gmt":"2015-09-28T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/09\/28\/use-powershell-to-create-windows-to-go-keyspart-1\/"},"modified":"2019-02-18T09:35:05","modified_gmt":"2019-02-18T16:35:05","slug":"use-powershell-to-create-windows-to-go-keyspart-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-create-windows-to-go-keyspart-1\/","title":{"rendered":"Use PowerShell to Create Windows To Go Keys&#8212;Part 1"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Use Windows PowerShell to identify Windows To Go devices.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;Hey, Scripting Guy! I&rsquo;ve heard a lot of talk about Windows To Go amongst the IT pros at our local user group. I was wondering how I would go about trying to create them with Windows PowerShell?<\/p>\n<p>&mdash;DM<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Hello DM,<\/p>\n<p>Honorary Scripting Guy, Sean Kearney, is here today, and I&rsquo;m happy to share that knowledge with you.<b style=\"font-size:12px\">&nbsp; &nbsp;<\/b><\/p>\n<p><b>&nbsp; &nbsp;Note<\/b>&nbsp;&nbsp;This is a five-part series that includes the following posts:<\/p>\n<ul>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/09\/28\/use-powershell-to-create-windows-to-go-keys-part-1.aspx\" target=\"_blank\">Use PowerShell to Create Windows To Go Keys&mdash;Part 1<\/a>&nbsp; <br \/> &nbsp;&nbsp;&nbsp;&nbsp; Use Windows PowerShell to identify Windows To Go devices.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/09\/29\/use-powershell-to-create-windows-to-go-keys-part-2.aspx\" target=\"_blank\">Use PowerShell to Create Windows To Go Keys&mdash;Part 2<\/a>&nbsp; <br \/> &nbsp;&nbsp;&nbsp;&nbsp; Use Windows PowerShell to partition a Windows To Go device.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/09\/30\/use-powershell-to-create-windows-to-go-keys-part-3.aspx\" target=\"_blank\">Use PowerShell to Create Windows To Go Keys&mdash;Part 3<\/a>&nbsp; <br \/> &nbsp;&nbsp;&nbsp;&nbsp; Use Windows PowerShell to apply an image to a Windows To Go key and make it bootable.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/10\/01\/use-powershell-to-create-windows-to-go-keys-part-4.aspx\" target=\"_blank\">Use PowerShell to Create Windows To Go Keys&mdash;Part 4<\/a>&nbsp; <br \/> &nbsp;&nbsp;&nbsp; &nbsp;Use Windows PowerShell to inject drivers and populate the data for Unattend.xml.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/10\/02\/use-powershell-to-create-windows-to-go-keys-part-5.aspx\" target=\"_blank\">Use PowerShell to Create Windows To Go Keys&mdash;Part 5<\/a>&nbsp; <br \/> &nbsp;&nbsp;&nbsp;&nbsp; Use a basic Windows PowerShell workflow to create multiple devices.<\/li>\n<\/ul>\n<p>Before I start on the Windows PowerShell part, I&rsquo;ll touch quickly on what Windows To Go is. It&rsquo;s a fully operational version of a supported Windows Enterprise operating system on an external USB device.<\/p>\n<p>The requirements to use Windows To Go are:<\/p>\n<ul>\n<li>Software assurance<\/li>\n<li>A qualified and supported hardware device (for more information, see <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/hh831833.aspx#wtg_hardware\" target=\"_blank\">Hardware considerations for Windows To Go<\/a>)<\/li>\n<li>One of the following &nbsp;operating systems:\n<ul>\n<li>Windows 10 Enterprise<\/li>\n<li>Windows 8.1 Enterprise<\/li>\n<li>Windows 8 Enterprise<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>It&rsquo;s a pretty cool option to put in to the hands of a business. What you end up with is the ability to have a Windows operating system that can be joined to your domain. It can be handed off to a contractor or even used for remote staff. When you boot it up from a USB device, the internal drives of the remote system are disabled, which allows you to use your system without foreign data easily corrupting the key.<\/p>\n<p>So our first challenge is to identify a Windows To Go key for imaging. For proper support from Microsoft, it should only be deployed to the device list indicated earlier, so targeting is actually pretty easy.<\/p>\n<p>I use the <b>Get-Disk<\/b> cmdlet in Windows to show the available devices. In the following example, I have an IronKey W300 attached to my computer.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3073.1.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3073.1.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>I could do some magic by targeting for USB devices that are external hard disks, maybe larger than a certain size, but because the list from Microsoft is a very finite list, I can simplify this.<\/p>\n<p><b>Get-Disk<\/b> has a property that I can filter on called <b>FriendlyName<\/b>. This allows us to show only devices with a specific name that is assigned by a vendor.<\/p>\n<p>To find the <b>FriendlyName<\/b> of our attached devices, I can pipe <b>Get-Disk<\/b> to <b>Select-Object<\/b>, and use the <b>&ndash;ExpandProperty<\/b> parameter to view the data.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3364.2.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3364.2.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>If I want to see only devices that have a particular friendly name, I can use two approaches. I can filter by using the <b>FriendlyName<\/b> parameter with the <b>Get-Disk<\/b> cmdlet:<\/p>\n<p style=\"margin-left:30px\">Get-Disk -FriendlyName &#039;Imation IronKey Wkspace&#039;<\/p>\n<p>If I wanted to trap for the IronKey W300 and a Kingston workspace, I can add them to the same list with the <b>FriendlyName<\/b> parameter:<\/p>\n<p style=\"margin-left:30px\">Get-Disk -FriendlyName &#039;Imation IronKey Wkspace&#039;,&rsquo;Kingston DT Ultimate&rsquo;<\/p>\n<p>But I have encountered a situation where <b>FriendlyName<\/b> is slightly different between Windows 10 and Windows 8.1. In Windows 8.1, the words <b>USB Device<\/b> get attached to the friendly name. To trap for this, I could list of every combination of <b>FriendlyName<\/b>, or I can filter in a different manner.<\/p>\n<p>I can pipe <b>Get-Disk<\/b> to <b>Where-Object<\/b> and match the part of the name that is the same:<\/p>\n<p style=\"margin-left:30px\">Get-Disk | Where-Object { &#039;Imation IronKey Wkspace&#039;,&#039;Kingston DT Ultimate&#039;) -match $_.Friendlyname }<\/p>\n<p>I store this in an object called <b>WTG<\/b> so I can reference it later:<\/p>\n<p style=\"margin-left:30px\">$WTG= Get-Disk | Where-Object { &#039;Imation IronKey Wkspace&#039;,&#039;Kingston DT Ultimate&#039;) -match $_.Friendlyname }<\/p>\n<p>Stay tuned tomorrow when I&rsquo;ll be using Windows PowerShell to partition this device because I&rsquo;ll need it for use as a Windows to Go device.<\/p>\n<p>I invite you to follow The Scripting Guys on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send an email to The Scripting Guys at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, remember to eat your cmdlets every day with a dash of creativity.<\/p>\n<p><b>Sean Kearney<\/b>, Windows PowerShell MVP and Honorary Scripting Guy<span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use Windows PowerShell to identify Windows To Go devices. &nbsp;Hey, Scripting Guy! I&rsquo;ve heard a lot of talk about Windows To Go amongst the IT pros at our local user group. I was wondering how I would go about trying to create them with Windows PowerShell? &mdash;DM &nbsp;Hello DM, Honorary Scripting Guy, Sean Kearney, [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,154,45,616],"class_list":["post-73081","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-sean-kearney","tag-windows-powershell","tag-windows-to-go"],"acf":[],"blog_post_summary":"<p>Summary: Use Windows PowerShell to identify Windows To Go devices. &nbsp;Hey, Scripting Guy! I&rsquo;ve heard a lot of talk about Windows To Go amongst the IT pros at our local user group. I was wondering how I would go about trying to create them with Windows PowerShell? &mdash;DM &nbsp;Hello DM, Honorary Scripting Guy, Sean Kearney, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/73081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=73081"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/73081\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=73081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=73081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=73081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}