<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>format powershell Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/format-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Fri, 30 Apr 2021 22:44:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How to format USB with PowerShell</title>
		<link>https://www.osradar.com/how-to-format-usb-with-powershell/</link>
					<comments>https://www.osradar.com/how-to-format-usb-with-powershell/#respond</comments>
		
		<dc:creator><![CDATA[roger]]></dc:creator>
		<pubDate>Thu, 06 May 2021 21:41:00 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[format powershell]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[usb format]]></category>
		<category><![CDATA[windows powershell]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=29793</guid>

					<description><![CDATA[<p>It is well known that formatting a USB drive involves completely erasing its contents. Of course, there is a reason for this. Most of the time we do it because of access errors to the device, the presence of viruses, security measures, or malicious manipulation. Generally, we do this process graphically. That is, using the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-format-usb-with-powershell/">How to format USB with PowerShell</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>It is well known that formatting a USB drive involves completely erasing its contents. Of course, there is a reason for this. Most of the time we do it because of access errors to the device, the presence of viruses, security measures, or malicious manipulation. Generally, we do this process <a href="https://www.osradar.com/category/windows/" target="_blank" rel="noreferrer noopener">graphically. </a>That is, using the file explorer. Since it is enough to make the right click of the mouse on the device and to give the order to format. However, sometimes the system does not allow to perform the task. Perhaps you did not know that this can be done through the command line. Stay with us to learn how to format a USB with PowerShell.</p>



<h2>How to format a USB drive using PowerShell</h2>



<p>The first thing you have to do is to open a PowerShell with administrator privileges. With this in mind, press the Win+X combination. Next, select the corresponding option.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="272" height="612" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/ow.png" alt="Opening a PowerShell with administrator privileges" class="wp-image-29794" srcset="https://www.osradar.com/wp-content/uploads/2021/04/ow.png 272w, https://www.osradar.com/wp-content/uploads/2021/04/ow-133x300.png 133w" sizes="(max-width: 272px) 100vw, 272px" /><figcaption>Opening a PowerShell with administrator privileges</figcaption></figure>



<p>Then, you must use the following syntax:</p>



<pre class="wp-block-preformatted">Format-Volume -DriveLetter -FileSystem -NewFileSystemLabel </pre>



<p>Please note that the parameters are as follows:</p>



<ul><li>In the -DriveLetter line, enter the letter assigned by the system to the USB.</li><li>In the -FileSystem line please assign the format to set (NTFS, FAT32, etc).</li><li>NewFileSystemLabel allows you to add a label to the USB flash drive.</li></ul>



<p>In our example, the command would look like this:</p>



<pre class="wp-block-preformatted">Format-Volume -DriveLetter F -FileSystem NTFS -NewFileSystemLabel Osradar</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="846" height="673" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/pw2.png" alt="Forming a USB device with PowerShell" class="wp-image-29795" srcset="https://www.osradar.com/wp-content/uploads/2021/04/pw2.png 846w, https://www.osradar.com/wp-content/uploads/2021/04/pw2-300x239.png 300w, https://www.osradar.com/wp-content/uploads/2021/04/pw2-768x611.png 768w, https://www.osradar.com/wp-content/uploads/2021/04/pw2-696x554.png 696w" sizes="(max-width: 846px) 100vw, 846px" /><figcaption>Forming a USB device with PowerShell</figcaption></figure>



<p>At the end of the process, a message like this will be displayed.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="323" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/pw3.png" alt="" class="wp-image-29797" srcset="https://www.osradar.com/wp-content/uploads/2021/04/pw3.png 859w, https://www.osradar.com/wp-content/uploads/2021/04/pw3-300x113.png 300w, https://www.osradar.com/wp-content/uploads/2021/04/pw3-768x289.png 768w, https://www.osradar.com/wp-content/uploads/2021/04/pw3-696x262.png 696w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<h2>How to perform low-level formatting with PowerShell</h2>



<p>It is also possible to perform a low-level formatting. That is, a more complete task that takes more time. However, it allows to erase more complete sectors of the USB drive. Please use the following syntax:</p>



<pre class="wp-block-preformatted">Format-Volume -DriveLetter -FileSystem -Full -Force</pre>



<p>See the image for a particular example:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="430" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/pw4.png" alt="Formatting a usb device at low level. " class="wp-image-29798" srcset="https://www.osradar.com/wp-content/uploads/2021/04/pw4.png 859w, https://www.osradar.com/wp-content/uploads/2021/04/pw4-300x150.png 300w, https://www.osradar.com/wp-content/uploads/2021/04/pw4-768x384.png 768w, https://www.osradar.com/wp-content/uploads/2021/04/pw4-696x348.png 696w" sizes="(max-width: 859px) 100vw, 859px" /><figcaption>Formatting a usb device at low level.</figcaption></figure>



<p>After a while, we will see a window similar to the previous one.</p>



<h2>Other operations available from PowerShell. Erasing the contents of the USB flash drive.</h2>



<p>We can also perform other operations from the console. In this opportunity we will erase the content of the USB memory. With this in mind, from the PowerShell with administrator privileges please run the following command:</p>



<pre class="wp-block-preformatted">Get-Disk</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="445" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/pw5.png" alt="" class="wp-image-29800" srcset="https://www.osradar.com/wp-content/uploads/2021/04/pw5.png 859w, https://www.osradar.com/wp-content/uploads/2021/04/pw5-300x155.png 300w, https://www.osradar.com/wp-content/uploads/2021/04/pw5-768x398.png 768w, https://www.osradar.com/wp-content/uploads/2021/04/pw5-696x361.png 696w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<p>This command shows a list of available disks. This command shows a list of available disks. In this case, the USB flash drive has the number 2 assigned to it. Consequently, we will erase the data from the disk using its number:</p>



<pre class="wp-block-preformatted">Get-Disk 2 | Clear-Disk -RemoveData</pre>



<p>Please note that the number may be different on your computer. Please press Y to confirm the operation.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="160" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/pw6.png" alt="Erasing the contents of the USB flash drive. " class="wp-image-29801" srcset="https://www.osradar.com/wp-content/uploads/2021/04/pw6.png 859w, https://www.osradar.com/wp-content/uploads/2021/04/pw6-300x56.png 300w, https://www.osradar.com/wp-content/uploads/2021/04/pw6-768x143.png 768w, https://www.osradar.com/wp-content/uploads/2021/04/pw6-696x130.png 696w" sizes="(max-width: 859px) 100vw, 859px" /><figcaption>Erasing the contents of the USB flash drive.</figcaption></figure>



<p>Now let&#8217;s create the new partition on the USB with the command:</p>



<pre class="wp-block-preformatted">New-Partition -DiskNumber 2 -UseMaximumSize</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="160" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/04/pw6-1.png" alt="" class="wp-image-29802" srcset="https://www.osradar.com/wp-content/uploads/2021/04/pw6-1.png 859w, https://www.osradar.com/wp-content/uploads/2021/04/pw6-1-300x56.png 300w, https://www.osradar.com/wp-content/uploads/2021/04/pw6-1-768x143.png 768w, https://www.osradar.com/wp-content/uploads/2021/04/pw6-1-696x130.png 696w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<p>With this command we have assigned the maximum capacity of the USB flash drive. </p>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="303" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/pw7.png" alt="" class="wp-image-29803" srcset="https://www.osradar.com/wp-content/uploads/2021/05/pw7.png 859w, https://www.osradar.com/wp-content/uploads/2021/05/pw7-300x106.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/pw7-768x271.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/pw7-696x246.png 696w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<p>Next we will apply a quick format with the desired file system:</p>



<pre class="wp-block-preformatted">Get-Partition -DiskNumber 2 | Format-Volume -FileSystem NTFS -NewFileSystemLabel Osradar</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="859" height="348" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/pw8.png" alt="" class="wp-image-29804" srcset="https://www.osradar.com/wp-content/uploads/2021/05/pw8.png 859w, https://www.osradar.com/wp-content/uploads/2021/05/pw8-300x122.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/pw8-768x311.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/pw8-696x282.png 696w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<p>Finally, we are going to assign the letter to the USB:</p>



<pre class="wp-block-preformatted">Get-Partition -DiskNumber 2 | Set-Partition -NewDriveLetter D</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="709" height="266" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/pw9.png" alt="" class="wp-image-29805" srcset="https://www.osradar.com/wp-content/uploads/2021/05/pw9.png 709w, https://www.osradar.com/wp-content/uploads/2021/05/pw9-300x113.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/pw9-696x261.png 696w" sizes="(max-width: 709px) 100vw, 709px" /></figure>



<p>You can notice how the system now recognizes the USB flash drive. To check it, just go to file explorer</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="787" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/pw10-1024x787.png" alt="" class="wp-image-29806" srcset="https://www.osradar.com/wp-content/uploads/2021/05/pw10-1024x787.png 1024w, https://www.osradar.com/wp-content/uploads/2021/05/pw10-300x231.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/pw10-768x590.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/pw10-696x535.png 696w, https://www.osradar.com/wp-content/uploads/2021/05/pw10-1068x821.png 1068w, https://www.osradar.com/wp-content/uploads/2021/05/pw10.png 1280w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Okay, so we have seen how to format a USB flash drive with <a href="https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.1">PowerShell.</a> It is an option to properly clean these devices. Goodbye!</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-format-usb-with-powershell/">How to format USB with PowerShell</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-format-usb-with-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
