<?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>Scripting - Fix The Exchange!</title>
	<atom:link href="https://www.fixtheexchange.com/tag/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fixtheexchange.com</link>
	<description>Official Blog of Josh M. Bryant</description>
	<lastBuildDate>Fri, 05 Dec 2025 16:17:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>Mass deletion of databases on an Exchange 2010 Database Availability Group.</title>
		<link>https://www.fixtheexchange.com/2011/10/20/mass-deletion-of-databases-on-an-exchange-2010-database-availability-group/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mass-deletion-of-databases-on-an-exchange-2010-database-availability-group&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mass-deletion-of-databases-on-an-exchange-2010-database-availability-group</link>
		
		<dc:creator><![CDATA[Josh Bryant]]></dc:creator>
		<pubDate>Thu, 20 Oct 2011 21:46:04 +0000</pubDate>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">http://www.fixtheexchange.com/mass-deletion-of-databases-on-an-exchange-2010-database-availability-group/</guid>

					<description><![CDATA[<p>Last week I showed you a script that I wrote to create a mass amount of databases and database copies on an Exchange 2010 Database Availability Group (DAG).&#160;&#160; Since that script was a work in progress, I needed to test it again.&#160; This meant I needed to get rid of most of the databases it [&#8230;]</p>
<p>The post <a href="https://www.fixtheexchange.com/2011/10/20/mass-deletion-of-databases-on-an-exchange-2010-database-availability-group/">Mass deletion of databases on an Exchange 2010 Database Availability Group.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Last week I showed you a script that I wrote to create a <a href="http://www.fixtheexchange.com/automating-mass-exchange-2010-database-creation-powershell">mass amount of databases and database copies on an Exchange 2010 Database Availability Group (DAG).&nbsp;</a>&nbsp; Since that script was a work in progress, I needed to test it again.&nbsp; This meant I needed to get rid of most of the databases it created the first time I ran it.&nbsp; To do this, I used the same .csv file to create the databases, and just removed the databases from the list that I didn&#39;t want deleted.&nbsp;&nbsp; Then I ran this script I called rmdb.ps1:</p>
<blockquote>
<p># Remove Databases<br />
		# By Josh M. Bryant<br />
		# <a href="http://www.fixtheexchange.com">www.fixtheexchange.com</a><br />
		#<br />
		$data = Import-CSV C:\Scripts\dbcreate\exdbs.csv<br />
		$Servers = Get-MailboxServer | Where {$_.DatabaseAvailabilityGroup -ne $null}<br />
		ForEach ($line in $data)<br />
		{<br />
		$dbname = $line.DBName<br />
		&nbsp;&nbsp; &nbsp;ForEach($Server in $Servers)<br />
		&nbsp;&nbsp; &nbsp;{<br />
		&nbsp;&nbsp; &nbsp;Remove-MailboxDatabaseCopy -Identity $dbname\$Server -Confirm:$False<br />
		&nbsp;&nbsp; &nbsp;}<br />
		Remove-MailboxDatabase -Identity $dbname -Confirm:$false<br />
		}</p>
<hr />
<p>&nbsp;</p>
</blockquote>
<p>On an Exchange 2010 DAG, you have to delete all copies of the database BEFORE it will allow you to delete the database.&nbsp; The GUI will only allow you to do this one at a time, so if you&#39;ve got a large number of databases that need deleting, this script is a real time saver.&nbsp; Database copies and databases are deleted much faster than they&#39;re created.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img decoding="async" src="https://www.fixtheexchange.com/wp-content/uploads/2025/12/4000px_transparent-scaled.png" width="100"  height="100" alt="" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.fixtheexchange.com/author/josh/" class="vcard author" rel="author"><span class="fn">Josh Bryant</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Cybersecurity Product Leader and internationally recognized Speaker at several Information Security conferences and events with over 26 years of experience as a proven leader in Cybersecurity, Product Management, Threat Hunting, Incident Response, IT Management, IT Architecture, IT Operations, IT Engineering, and Messaging Systems, on a global scale, across a diverse set of industries in both the Public and Private sectors.</p>
</div></div><div class="saboxplugin-web "><a href="http://192.168.2.21:30040" target="_self" >192.168.2.21:30040</a></div><div class="clearfix"></div><div class="saboxplugin-socials sabox-colored"><a title="Linkedin" target="_self" href="https://www.linkedin.com/in/josh-m-bryant/" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-linkedin" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 7.6-0.4 15.2-1 22.6-0.2 2.2-0.4 4.4-0.7 6.6-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7 0 0.3-0.1 0.6-0.2 0.9-0.2 1-0.4 1.9-0.5 2.9-0.2 0.8-0.4 1.6-0.5 2.5-0.1 0.3-0.1 0.5-0.2 0.8-0.7 3.3-1.5 6.5-2.3 9.7-0.6 2.3-1.2 4.5-1.9 6.8-1.5 5.3-3.2 10.5-5 15.6-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2c-0.2 0-0.3 0.1-0.5 0.1l-3 0.6c-1.8 0.3-3.6 0.6-5.4 0.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#0077b5" /><path class="st1" d="m485 335.5c-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2l-148.3-148.1 35.3-142.9-32-37.6 38.1-38.7 68 68.4h11.9l9.5 9.3 70.5-3.9 135 133.3z" /><path class="st2" d="m195.6 347.6h-46.9v-150.8h46.9v150.8zm-23.5-171.4c-15 0-27.1-12.4-27.1-27.4s12.2-27.1 27.1-27.1c15 0 27.1 12.2 27.1 27.1s-12.1 27.4-27.1 27.4zm198.9 171.4h-46.8v-73.4c0-17.5-0.4-39.9-24.4-39.9-24.4 0-28.1 19-28.1 38.7v74.7h-46.8v-150.9h44.9v20.6h0.7c6.3-11.9 21.5-24.4 44.3-24.4 47.4 0 56.1 31.2 56.1 71.8l0.1 82.8z" /></svg></span></a><a title="Twitter" target="_self" href="https://x.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-twitter" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 148 148">
  <path d="M 63.907 0.948 C 37.893 3.663 14.65 20.788 4.083 45.024 C -2.727 60.67 -3.86 78.686 0.975 95.272 C 6.947 115.953 22.396 133.424 42.387 142.162 C 58.034 148.972 76.05 150.106 92.636 145.27 C 117.461 138.113 137.009 117.731 143.424 92.408 C 153.443 52.724 128.862 12.148 89.079 2.675 C 80.342 0.602 72.646 0.058 63.907 0.948 Z M 64.893 46.801 C 71.21 55.192 76.544 62.103 76.741 62.103 C 76.938 62.103 83.504 55.192 91.252 46.801 L 105.419 31.5 L 113.463 31.5 L 111.735 33.328 C 110.749 34.361 104.332 41.322 97.47 48.775 C 90.61 56.229 83.898 63.483 82.563 64.817 L 80.194 67.334 L 98.705 91.965 C 108.874 105.538 117.215 116.789 117.215 116.99 C 117.215 117.238 111.145 117.383 103.787 117.383 L 90.314 117.334 L 77.777 100.553 C 69.14 88.954 65.092 83.965 64.697 84.265 C 64.401 84.512 57.39 92.065 49.1 101.046 L 34.045 117.383 L 30.242 117.383 C 28.122 117.383 26.395 117.283 26.395 117.138 C 26.395 116.99 34.243 108.398 43.816 98.084 C 53.345 87.768 61.243 79.131 61.339 78.984 C 61.391 78.784 53.542 68.074 43.918 55.192 C 34.293 42.359 26.395 31.747 26.395 31.646 C 26.395 31.55 32.465 31.5 39.919 31.5 L 53.442 31.5 L 64.893 46.801 Z M 64.893 46.801" />
  <path d="M 38.588 38.114 C 38.784 38.459 51.22 55.142 66.128 75.082 L 93.276 111.411 L 99.344 111.461 C 103.098 111.461 105.368 111.263 105.267 110.966 C 105.222 110.721 92.832 94.04 77.827 73.949 L 50.48 37.423 L 44.361 37.423 C 39.279 37.423 38.242 37.524 38.589 38.114 L 38.588 38.114 Z M 38.588 38.114" />
</svg></span></a><a title="Github" target="_self" href="https://github.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-github" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 9.9-0.6 19.7-1.7 29.2-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#4078c0" /><path class="st1" d="m495.6 296.3c-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9l-140.4-141.1-14.9-35.9-7.8-71 32.6-89.2 79.9-17.7 111.5 7.2 146.6 146.7z" /><path class="st2" d="m204 339c0 1.2-1.3 2.1-3 2.1-1.9 0.2-3.3-0.8-3.3-2.1 0-1.2 1.3-2.1 3-2.1 1.8-0.1 3.3 0.8 3.3 2.1zm-18.1-2.6c-0.4 1.2 0.8 2.5 2.5 2.8 1.5 0.6 3.3 0 3.6-1.2s-0.8-2.5-2.5-3c-1.5-0.3-3.2 0.3-3.6 1.4zm25.7-1c-1.7 0.4-2.8 1.5-2.7 2.8 0.2 1.2 1.7 1.9 3.4 1.5s2.8-1.5 2.7-2.7c-0.2-1-1.7-1.7-3.4-1.6zm38.2-222.8c-80.6 0-142.3 61.2-142.3 141.9 0 64.5 40.6 119.7 98.5 139.1 7.4 1.3 10.1-3.3 10.1-7 0-3.6-0.2-23.5-0.2-35.7 0 0-40.7 8.7-49.2-17.3 0 0-6.6-16.9-16.2-21.3 0 0-13.3-9.1 0.9-9 0 0 14.5 1.2 22.4 15 12.7 22.4 34.1 16 42.4 12.2 1.3-9.3 5.1-15.8 9.3-19.6-32.5-3.6-65.3-8.3-65.3-64.2 0-16 4.4-24 13.7-34.2-1.5-3.8-6.5-19.4 1.5-39.5 12.2-3.8 40.1 15.7 40.1 15.7 11.6-3.3 24.1-4.9 36.5-4.9s24.9 1.7 36.5 4.9c0 0 28-19.5 40.1-15.7 8 20.2 3 35.7 1.5 39.5 9.3 10.3 15 18.3 15 34.2 0 56.1-34.2 60.6-66.7 64.2 5.3 4.6 9.9 13.3 9.9 27 0 19.6-0.2 43.8-0.2 48.6 0 3.8 2.7 8.4 10.1 7 58.1-19.3 97.6-74.5 97.6-139 0.1-80.6-65.3-141.9-146-141.9zm-85.8 200.6c-0.8 0.6-0.6 1.9 0.4 3 0.9 0.9 2.3 1.3 3 0.6 0.8-0.6 0.6-1.9-0.4-3-0.9-1-2.2-1.4-3-0.6zm-6.3-4.7c-0.4 0.8 0.2 1.7 1.3 2.3 0.9 0.6 2.1 0.4 2.5-0.4s-0.2-1.7-1.3-2.3c-1.1-0.4-2-0.2-2.5 0.4zm18.9 20.7c-0.9 0.8-0.6 2.5 0.8 3.6 1.3 1.3 3 1.5 3.8 0.6 0.8-0.8 0.4-2.5-0.8-3.6-1.3-1.4-3.1-1.6-3.8-0.6zm-6.6-8.6c-0.9 0.6-0.9 2.1 0 3.4s2.5 1.9 3.3 1.3c0.9-0.8 0.9-2.3 0-3.6s-2.4-1.8-3.3-1.1z" /></svg></span></a></div></div></div><p>The post <a href="https://www.fixtheexchange.com/2011/10/20/mass-deletion-of-databases-on-an-exchange-2010-database-availability-group/">Mass deletion of databases on an Exchange 2010 Database Availability Group.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Automating mass Exchange 2010 database creation with PowerShell.</title>
		<link>https://www.fixtheexchange.com/2011/10/10/automating-mass-exchange-2010-database-creation-with-powershell/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automating-mass-exchange-2010-database-creation-with-powershell&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automating-mass-exchange-2010-database-creation-with-powershell</link>
		
		<dc:creator><![CDATA[Josh Bryant]]></dc:creator>
		<pubDate>Mon, 10 Oct 2011 21:27:25 +0000</pubDate>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">http://www.fixtheexchange.com/automating-mass-exchange-2010-database-creation-with-powershell/</guid>

					<description><![CDATA[<p>A few weeks ago, I showed you my solution to creating a mass amount of disks with PowerShell and diskpart, for future use as Exchange 2010 database and log drives.&#160;&#160; I finally had time to go back and create the databases for this environment.&#160;&#160; In this environment, I had 4 Exchange 2010 servers with the [&#8230;]</p>
<p>The post <a href="https://www.fixtheexchange.com/2011/10/10/automating-mass-exchange-2010-database-creation-with-powershell/">Automating mass Exchange 2010 database creation with PowerShell.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>A few weeks ago, I showed you my solution to creating a mass amount of disks with PowerShell and diskpart, for future use as Exchange 2010 database and log drives.&nbsp;&nbsp; I finally had time to go back and create the databases for this environment.&nbsp;&nbsp; In this environment, I had 4 Exchange 2010 servers with the Mailbox (MB) role on them, all part of the same Database Availability Group (DAG).&nbsp;&nbsp; I needed to create a total of 97 databases, and 376 database copies in this DAG.&nbsp;&nbsp; To do this, I wrote the following script I called &quot;dbcreate.ps1&quot;</p>
<blockquote>
<hr />
<p># Exchange 2010 Database Creation Script<br />
		# By Josh M. Bryant<br />
		# Last updated 10/18/2011 11:00 AM<br />
		#<br />
		#<br />
		# Specify database root path.<br />
		$dbroot = &quot;E:\EXCH10&quot;<br />
		#<br />
		# Specify log file root path.<br />
		$logroot = &quot;L:\EXCH10&quot;<br />
		#<br />
		# Specify CSV file containing database/log paths and database names.<br />
		$data = Import-CSV C:\Scripts\dbcreate\exdbs.csv<br />
		#<br />
		# Get list of mailbox servers that are members of a DAG.<br />
		$Servers = Get-MailboxServer | Where {$_.DatabaseAvailabilityGroup -ne $null}<br />
		#<br />
		# Specify Lagged Copy Server identifier.<br />
		$lci = &quot;MBL&quot;<br />
		#<br />
		# Specify ReplayLagTime in fromat Days.Hours:Minutes:Seconds<br />
		$ReplayLagTime = &quot;14.0:00:00&quot;<br />
		#<br />
		#Specify TruncationLagTime in format Days.Hours:Minutes:Seconds<br />
		$TruncationLagTime = &quot;0.1:00:00&quot;<br />
		#<br />
		# Specify RpcClientAccessServer name.<br />
		$RPC = &quot;mail.domain.com&quot;<br />
		#<br />
		#<br />
		#<br />
		# Create databases.<br />
		ForEach ($line in $data)<br />
		{<br />
		$dbpath = $line.DBPath<br />
		$dbname = $line.DBName<br />
		$logpath = $line.LogPath<br />
		New-MailboxDatabase -Name $dbname -Server $line.Server -EdbFilePath $dbroot\$dbpath\$dbname.edb -LogFolderPath $logroot\$logpath<br />
		}<br />
		#<br />
		# Mount all databases.<br />
		Get-MailboxDatabase | Mount-Database<br />
		Start-Sleep -s 60<br />
		#<br />
		# Create Database Copies.<br />
		ForEach ($line in $data)<br />
		{<br />
		ForEach ($Server in $Servers)<br />
		&nbsp;&nbsp; &nbsp;{<br />
		&nbsp;&nbsp; &nbsp;If ($Server -notlike $line.Server)<br />
		&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
		&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Add-MailboxDatabaseCopy -Identity $line.DBName -MailboxServer $Server<br />
		&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
		&nbsp;&nbsp; &nbsp;}<br />
		}<br />
		#<br />
		# Setup lagged copies.<br />
		ForEach ($Server in $Servers)<br />
		{<br />
		If ($Server -like &quot;*$lci*&quot;)<br />
		&nbsp;&nbsp; &nbsp;{<br />
		&nbsp;&nbsp; &nbsp;Get-MailboxDatabaseCopyStatus -Server $Server | Set-MailboxDatabaseCopy -ReplayLagTime $ReplayLagTime -TruncationLagTime $TruncationLagTime<br />
		&nbsp;&nbsp; &nbsp;}<br />
		}<br />
		#<br />
		# Set RpcClientAccess Server and enable Circular Logging on all databases.<br />
		Get-MailboxServer | Get-MailboxDatabase | Set-MailboxDatabase &ndash;RpcClientAccessServer $RPC -CircularLoggingEnabled $true</p>
<hr />
</blockquote>
<p>The exdbs.csv file reference in the script, contained these 4 columns: &quot;Server,DBPath,DBName,LogPath&quot;.</p>
<p>The script first creates the 94 databases, 47 of them on one server, 47 on another.&nbsp; It then creaties copies of all these databases across all servers in the DAG.&nbsp; 2 of the servers are for lagged copies, so it goes and sets those based on server naming convention.&nbsp; The final set is to set the RpcClientAccessServer to the FQDN of the CAS Array on all databases. <span style="color:#b22222;">UPDATE: I have the script setting all the databases for circular logging at the very end now too.</span></p>
<p>This is still a work in progress, so use at your own risk.&nbsp; As always please leave author information at the top of the script intact if you use it, and don&#39;t forget to link back to this site if you share it anywhere else.</p>
<p>The script worked great, <strike>despite having a few &quot;RPC endpoint mapper&quot; errors</strike>.&nbsp; It got the databases 95% setup.&nbsp; <strike>One server had a service not running on it, </strike>so the database copies were in the &quot;Suspended&quot; state on it.&nbsp; Simple use of the &quot;Resume-MailboxDatabaseCopy&quot; command easily correct this issue.&nbsp;&nbsp; I also had to go back and specify the Activation Preference, which was easy to do based on the naming convention, running the Get-MailboxDatabaseCopyStatus command against each server and piping it into the Set-MailboxDatabaseCopy -ActivationPreference command.</p>
<p><span style="color:#b22222;">UPDATE: I made some changes to the script, and no longer saw any errors during database creation.&nbsp; I also fixed the syntax for the database and log paths so they get created in the correct location.&nbsp;&nbsp; </span></p>
<p>The end result was 367 fully functional and ready to use database copies.&nbsp; Even with the minor clean-up after running the script, it made everything a lot easier.&nbsp; Creating this many database copies would have taken quite some time if done manually.</p>
<p>&nbsp;</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img decoding="async" src="https://www.fixtheexchange.com/wp-content/uploads/2025/12/4000px_transparent-scaled.png" width="100"  height="100" alt="" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.fixtheexchange.com/author/josh/" class="vcard author" rel="author"><span class="fn">Josh Bryant</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Cybersecurity Product Leader and internationally recognized Speaker at several Information Security conferences and events with over 26 years of experience as a proven leader in Cybersecurity, Product Management, Threat Hunting, Incident Response, IT Management, IT Architecture, IT Operations, IT Engineering, and Messaging Systems, on a global scale, across a diverse set of industries in both the Public and Private sectors.</p>
</div></div><div class="saboxplugin-web "><a href="http://192.168.2.21:30040" target="_self" >192.168.2.21:30040</a></div><div class="clearfix"></div><div class="saboxplugin-socials sabox-colored"><a title="Linkedin" target="_self" href="https://www.linkedin.com/in/josh-m-bryant/" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-linkedin" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 7.6-0.4 15.2-1 22.6-0.2 2.2-0.4 4.4-0.7 6.6-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7 0 0.3-0.1 0.6-0.2 0.9-0.2 1-0.4 1.9-0.5 2.9-0.2 0.8-0.4 1.6-0.5 2.5-0.1 0.3-0.1 0.5-0.2 0.8-0.7 3.3-1.5 6.5-2.3 9.7-0.6 2.3-1.2 4.5-1.9 6.8-1.5 5.3-3.2 10.5-5 15.6-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2c-0.2 0-0.3 0.1-0.5 0.1l-3 0.6c-1.8 0.3-3.6 0.6-5.4 0.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#0077b5" /><path class="st1" d="m485 335.5c-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2l-148.3-148.1 35.3-142.9-32-37.6 38.1-38.7 68 68.4h11.9l9.5 9.3 70.5-3.9 135 133.3z" /><path class="st2" d="m195.6 347.6h-46.9v-150.8h46.9v150.8zm-23.5-171.4c-15 0-27.1-12.4-27.1-27.4s12.2-27.1 27.1-27.1c15 0 27.1 12.2 27.1 27.1s-12.1 27.4-27.1 27.4zm198.9 171.4h-46.8v-73.4c0-17.5-0.4-39.9-24.4-39.9-24.4 0-28.1 19-28.1 38.7v74.7h-46.8v-150.9h44.9v20.6h0.7c6.3-11.9 21.5-24.4 44.3-24.4 47.4 0 56.1 31.2 56.1 71.8l0.1 82.8z" /></svg></span></a><a title="Twitter" target="_self" href="https://x.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-twitter" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 148 148">
  <path d="M 63.907 0.948 C 37.893 3.663 14.65 20.788 4.083 45.024 C -2.727 60.67 -3.86 78.686 0.975 95.272 C 6.947 115.953 22.396 133.424 42.387 142.162 C 58.034 148.972 76.05 150.106 92.636 145.27 C 117.461 138.113 137.009 117.731 143.424 92.408 C 153.443 52.724 128.862 12.148 89.079 2.675 C 80.342 0.602 72.646 0.058 63.907 0.948 Z M 64.893 46.801 C 71.21 55.192 76.544 62.103 76.741 62.103 C 76.938 62.103 83.504 55.192 91.252 46.801 L 105.419 31.5 L 113.463 31.5 L 111.735 33.328 C 110.749 34.361 104.332 41.322 97.47 48.775 C 90.61 56.229 83.898 63.483 82.563 64.817 L 80.194 67.334 L 98.705 91.965 C 108.874 105.538 117.215 116.789 117.215 116.99 C 117.215 117.238 111.145 117.383 103.787 117.383 L 90.314 117.334 L 77.777 100.553 C 69.14 88.954 65.092 83.965 64.697 84.265 C 64.401 84.512 57.39 92.065 49.1 101.046 L 34.045 117.383 L 30.242 117.383 C 28.122 117.383 26.395 117.283 26.395 117.138 C 26.395 116.99 34.243 108.398 43.816 98.084 C 53.345 87.768 61.243 79.131 61.339 78.984 C 61.391 78.784 53.542 68.074 43.918 55.192 C 34.293 42.359 26.395 31.747 26.395 31.646 C 26.395 31.55 32.465 31.5 39.919 31.5 L 53.442 31.5 L 64.893 46.801 Z M 64.893 46.801" />
  <path d="M 38.588 38.114 C 38.784 38.459 51.22 55.142 66.128 75.082 L 93.276 111.411 L 99.344 111.461 C 103.098 111.461 105.368 111.263 105.267 110.966 C 105.222 110.721 92.832 94.04 77.827 73.949 L 50.48 37.423 L 44.361 37.423 C 39.279 37.423 38.242 37.524 38.589 38.114 L 38.588 38.114 Z M 38.588 38.114" />
</svg></span></a><a title="Github" target="_self" href="https://github.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-github" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 9.9-0.6 19.7-1.7 29.2-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#4078c0" /><path class="st1" d="m495.6 296.3c-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9l-140.4-141.1-14.9-35.9-7.8-71 32.6-89.2 79.9-17.7 111.5 7.2 146.6 146.7z" /><path class="st2" d="m204 339c0 1.2-1.3 2.1-3 2.1-1.9 0.2-3.3-0.8-3.3-2.1 0-1.2 1.3-2.1 3-2.1 1.8-0.1 3.3 0.8 3.3 2.1zm-18.1-2.6c-0.4 1.2 0.8 2.5 2.5 2.8 1.5 0.6 3.3 0 3.6-1.2s-0.8-2.5-2.5-3c-1.5-0.3-3.2 0.3-3.6 1.4zm25.7-1c-1.7 0.4-2.8 1.5-2.7 2.8 0.2 1.2 1.7 1.9 3.4 1.5s2.8-1.5 2.7-2.7c-0.2-1-1.7-1.7-3.4-1.6zm38.2-222.8c-80.6 0-142.3 61.2-142.3 141.9 0 64.5 40.6 119.7 98.5 139.1 7.4 1.3 10.1-3.3 10.1-7 0-3.6-0.2-23.5-0.2-35.7 0 0-40.7 8.7-49.2-17.3 0 0-6.6-16.9-16.2-21.3 0 0-13.3-9.1 0.9-9 0 0 14.5 1.2 22.4 15 12.7 22.4 34.1 16 42.4 12.2 1.3-9.3 5.1-15.8 9.3-19.6-32.5-3.6-65.3-8.3-65.3-64.2 0-16 4.4-24 13.7-34.2-1.5-3.8-6.5-19.4 1.5-39.5 12.2-3.8 40.1 15.7 40.1 15.7 11.6-3.3 24.1-4.9 36.5-4.9s24.9 1.7 36.5 4.9c0 0 28-19.5 40.1-15.7 8 20.2 3 35.7 1.5 39.5 9.3 10.3 15 18.3 15 34.2 0 56.1-34.2 60.6-66.7 64.2 5.3 4.6 9.9 13.3 9.9 27 0 19.6-0.2 43.8-0.2 48.6 0 3.8 2.7 8.4 10.1 7 58.1-19.3 97.6-74.5 97.6-139 0.1-80.6-65.3-141.9-146-141.9zm-85.8 200.6c-0.8 0.6-0.6 1.9 0.4 3 0.9 0.9 2.3 1.3 3 0.6 0.8-0.6 0.6-1.9-0.4-3-0.9-1-2.2-1.4-3-0.6zm-6.3-4.7c-0.4 0.8 0.2 1.7 1.3 2.3 0.9 0.6 2.1 0.4 2.5-0.4s-0.2-1.7-1.3-2.3c-1.1-0.4-2-0.2-2.5 0.4zm18.9 20.7c-0.9 0.8-0.6 2.5 0.8 3.6 1.3 1.3 3 1.5 3.8 0.6 0.8-0.8 0.4-2.5-0.8-3.6-1.3-1.4-3.1-1.6-3.8-0.6zm-6.6-8.6c-0.9 0.6-0.9 2.1 0 3.4s2.5 1.9 3.3 1.3c0.9-0.8 0.9-2.3 0-3.6s-2.4-1.8-3.3-1.1z" /></svg></span></a></div></div></div><p>The post <a href="https://www.fixtheexchange.com/2011/10/10/automating-mass-exchange-2010-database-creation-with-powershell/">Automating mass Exchange 2010 database creation with PowerShell.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Creating 188 volume mount points in under 2 minutes with PowerShell and diskpart.</title>
		<link>https://www.fixtheexchange.com/2011/09/06/creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart</link>
		
		<dc:creator><![CDATA[Josh Bryant]]></dc:creator>
		<pubDate>Tue, 06 Sep 2011 13:37:12 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">http://www.fixtheexchange.com/creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart/</guid>

					<description><![CDATA[<p>Last week I showed you how I used PowerShell and diskpart to partition, format, and label 193 disks. If you&#8217;ll recall, I said I still needed to figure out how to get 188 of those disks mapped to folders for Volume Mount Points. My goal was to get this 100% automated. Due to time constraints, [&#8230;]</p>
<p>The post <a href="https://www.fixtheexchange.com/2011/09/06/creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart/">Creating 188 volume mount points in under 2 minutes with PowerShell and diskpart.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.fixtheexchange.com/configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart/">Last week I showed you how I used PowerShell and diskpart to partition, format, and label 193 disks.</a>  If you&#8217;ll recall, I said I still needed to figure out how to get 188 of those disks mapped to folders for Volume Mount Points.</p>
<p>My goal was to get this 100% automated.  Due to time constraints, I&#8217;m only at about 95%.  This last bit takes a small amount of manual work.  Don&#8217;t worry, it&#8217;s just simple copy and paste.</p>
<p>First we need to list out all volumes, to do this, open PowerShell, and run diskpart.<br />
<code><br />
diskpart<br />
list volume<br />
exit<br />
</code></p>
<p>Next we just open Excel, put &#8220;Volume&#8221; in cell A1, and &#8220;Label&#8221; in cell B1.  Copy &#8220;Volume ###&#8221; from the diskpart output and paste it into column A of the Excel sheet.  Copy &#8220;Label&#8221; from the diskpart output and paste it into column B.  Remove any disks that already have drive letters assigned.  If you remember from last week, I had 5 disks that I assigned drive letters.  After removing them from this list, I had 188 rows (not including the column names in row 1).   Save it as a .csv file</p>
<p>Next we run a PowerShell script I called cvmp.ps1:<br />
<code><br />
# Volume Mount Point Creation Script<br />
# By Josh M. Bryant<br />
# www.fixtheexchange.com<br />
# Last modified 9/6/2011 8:30 AM<br />
#<br />
$dmount = "E:EXCH10"<br />
$lmount = "L:EXCH10"<br />
$data = Import-CSV C:Scriptsvolumes.csv<br />
ForEach ($line in $data)<br />
{<br />
$volume = $line.Volume<br />
$label = $line.Label<br />
Add-Content -path C:Scriptsvolumes.txt -value "Select $volume"<br />
	If ($label -like "*L*")<br />
	{<br />
	Add-Content -path C:Scriptsvolumes.txt -value "assign mount=$lmount$label"<br />
	}<br />
	Else<br />
	{<br />
	Add-Content -path C:Scriptsvolumes.txt -value "assign mount=$dmount$label"<br />
	}<br />
}<br />
diskpart /s C:Scriptsvolumes.txt<br />
</code></p>
<p>That&#8217;s it!  The PowerShell uses the .csv file to create the diskpart script that assigns the volume mount points.</p>
<p>I would eventually like to go back and script out the .csv file creation using the Export-CSV command.  I was having trouble getting the output from the diskpart command (which is not a PowerShell command) into a usable format with the Export-CSV command.</p>
<p>Even with the manual copy and paste work, this saved a ton of time.  Can you imagine how long all of this would have taken without scripting?</p>
<p>If you use scripts from this site, please keep the author info intact, and include a link back to this site if you post them anywhere else.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img decoding="async" src="https://www.fixtheexchange.com/wp-content/uploads/2025/12/4000px_transparent-scaled.png" width="100"  height="100" alt="" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.fixtheexchange.com/author/josh/" class="vcard author" rel="author"><span class="fn">Josh Bryant</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Cybersecurity Product Leader and internationally recognized Speaker at several Information Security conferences and events with over 26 years of experience as a proven leader in Cybersecurity, Product Management, Threat Hunting, Incident Response, IT Management, IT Architecture, IT Operations, IT Engineering, and Messaging Systems, on a global scale, across a diverse set of industries in both the Public and Private sectors.</p>
</div></div><div class="saboxplugin-web "><a href="http://192.168.2.21:30040" target="_self" >192.168.2.21:30040</a></div><div class="clearfix"></div><div class="saboxplugin-socials sabox-colored"><a title="Linkedin" target="_self" href="https://www.linkedin.com/in/josh-m-bryant/" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-linkedin" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 7.6-0.4 15.2-1 22.6-0.2 2.2-0.4 4.4-0.7 6.6-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7 0 0.3-0.1 0.6-0.2 0.9-0.2 1-0.4 1.9-0.5 2.9-0.2 0.8-0.4 1.6-0.5 2.5-0.1 0.3-0.1 0.5-0.2 0.8-0.7 3.3-1.5 6.5-2.3 9.7-0.6 2.3-1.2 4.5-1.9 6.8-1.5 5.3-3.2 10.5-5 15.6-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2c-0.2 0-0.3 0.1-0.5 0.1l-3 0.6c-1.8 0.3-3.6 0.6-5.4 0.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#0077b5" /><path class="st1" d="m485 335.5c-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2l-148.3-148.1 35.3-142.9-32-37.6 38.1-38.7 68 68.4h11.9l9.5 9.3 70.5-3.9 135 133.3z" /><path class="st2" d="m195.6 347.6h-46.9v-150.8h46.9v150.8zm-23.5-171.4c-15 0-27.1-12.4-27.1-27.4s12.2-27.1 27.1-27.1c15 0 27.1 12.2 27.1 27.1s-12.1 27.4-27.1 27.4zm198.9 171.4h-46.8v-73.4c0-17.5-0.4-39.9-24.4-39.9-24.4 0-28.1 19-28.1 38.7v74.7h-46.8v-150.9h44.9v20.6h0.7c6.3-11.9 21.5-24.4 44.3-24.4 47.4 0 56.1 31.2 56.1 71.8l0.1 82.8z" /></svg></span></a><a title="Twitter" target="_self" href="https://x.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-twitter" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 148 148">
  <path d="M 63.907 0.948 C 37.893 3.663 14.65 20.788 4.083 45.024 C -2.727 60.67 -3.86 78.686 0.975 95.272 C 6.947 115.953 22.396 133.424 42.387 142.162 C 58.034 148.972 76.05 150.106 92.636 145.27 C 117.461 138.113 137.009 117.731 143.424 92.408 C 153.443 52.724 128.862 12.148 89.079 2.675 C 80.342 0.602 72.646 0.058 63.907 0.948 Z M 64.893 46.801 C 71.21 55.192 76.544 62.103 76.741 62.103 C 76.938 62.103 83.504 55.192 91.252 46.801 L 105.419 31.5 L 113.463 31.5 L 111.735 33.328 C 110.749 34.361 104.332 41.322 97.47 48.775 C 90.61 56.229 83.898 63.483 82.563 64.817 L 80.194 67.334 L 98.705 91.965 C 108.874 105.538 117.215 116.789 117.215 116.99 C 117.215 117.238 111.145 117.383 103.787 117.383 L 90.314 117.334 L 77.777 100.553 C 69.14 88.954 65.092 83.965 64.697 84.265 C 64.401 84.512 57.39 92.065 49.1 101.046 L 34.045 117.383 L 30.242 117.383 C 28.122 117.383 26.395 117.283 26.395 117.138 C 26.395 116.99 34.243 108.398 43.816 98.084 C 53.345 87.768 61.243 79.131 61.339 78.984 C 61.391 78.784 53.542 68.074 43.918 55.192 C 34.293 42.359 26.395 31.747 26.395 31.646 C 26.395 31.55 32.465 31.5 39.919 31.5 L 53.442 31.5 L 64.893 46.801 Z M 64.893 46.801" />
  <path d="M 38.588 38.114 C 38.784 38.459 51.22 55.142 66.128 75.082 L 93.276 111.411 L 99.344 111.461 C 103.098 111.461 105.368 111.263 105.267 110.966 C 105.222 110.721 92.832 94.04 77.827 73.949 L 50.48 37.423 L 44.361 37.423 C 39.279 37.423 38.242 37.524 38.589 38.114 L 38.588 38.114 Z M 38.588 38.114" />
</svg></span></a><a title="Github" target="_self" href="https://github.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-github" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 9.9-0.6 19.7-1.7 29.2-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#4078c0" /><path class="st1" d="m495.6 296.3c-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9l-140.4-141.1-14.9-35.9-7.8-71 32.6-89.2 79.9-17.7 111.5 7.2 146.6 146.7z" /><path class="st2" d="m204 339c0 1.2-1.3 2.1-3 2.1-1.9 0.2-3.3-0.8-3.3-2.1 0-1.2 1.3-2.1 3-2.1 1.8-0.1 3.3 0.8 3.3 2.1zm-18.1-2.6c-0.4 1.2 0.8 2.5 2.5 2.8 1.5 0.6 3.3 0 3.6-1.2s-0.8-2.5-2.5-3c-1.5-0.3-3.2 0.3-3.6 1.4zm25.7-1c-1.7 0.4-2.8 1.5-2.7 2.8 0.2 1.2 1.7 1.9 3.4 1.5s2.8-1.5 2.7-2.7c-0.2-1-1.7-1.7-3.4-1.6zm38.2-222.8c-80.6 0-142.3 61.2-142.3 141.9 0 64.5 40.6 119.7 98.5 139.1 7.4 1.3 10.1-3.3 10.1-7 0-3.6-0.2-23.5-0.2-35.7 0 0-40.7 8.7-49.2-17.3 0 0-6.6-16.9-16.2-21.3 0 0-13.3-9.1 0.9-9 0 0 14.5 1.2 22.4 15 12.7 22.4 34.1 16 42.4 12.2 1.3-9.3 5.1-15.8 9.3-19.6-32.5-3.6-65.3-8.3-65.3-64.2 0-16 4.4-24 13.7-34.2-1.5-3.8-6.5-19.4 1.5-39.5 12.2-3.8 40.1 15.7 40.1 15.7 11.6-3.3 24.1-4.9 36.5-4.9s24.9 1.7 36.5 4.9c0 0 28-19.5 40.1-15.7 8 20.2 3 35.7 1.5 39.5 9.3 10.3 15 18.3 15 34.2 0 56.1-34.2 60.6-66.7 64.2 5.3 4.6 9.9 13.3 9.9 27 0 19.6-0.2 43.8-0.2 48.6 0 3.8 2.7 8.4 10.1 7 58.1-19.3 97.6-74.5 97.6-139 0.1-80.6-65.3-141.9-146-141.9zm-85.8 200.6c-0.8 0.6-0.6 1.9 0.4 3 0.9 0.9 2.3 1.3 3 0.6 0.8-0.6 0.6-1.9-0.4-3-0.9-1-2.2-1.4-3-0.6zm-6.3-4.7c-0.4 0.8 0.2 1.7 1.3 2.3 0.9 0.6 2.1 0.4 2.5-0.4s-0.2-1.7-1.3-2.3c-1.1-0.4-2-0.2-2.5 0.4zm18.9 20.7c-0.9 0.8-0.6 2.5 0.8 3.6 1.3 1.3 3 1.5 3.8 0.6 0.8-0.8 0.4-2.5-0.8-3.6-1.3-1.4-3.1-1.6-3.8-0.6zm-6.6-8.6c-0.9 0.6-0.9 2.1 0 3.4s2.5 1.9 3.3 1.3c0.9-0.8 0.9-2.3 0-3.6s-2.4-1.8-3.3-1.1z" /></svg></span></a></div></div></div><p>The post <a href="https://www.fixtheexchange.com/2011/09/06/creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart/">Creating 188 volume mount points in under 2 minutes with PowerShell and diskpart.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Configuring 193 disks in under 2 minutes with PowerShell and diskpart.</title>
		<link>https://www.fixtheexchange.com/2011/09/02/configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart</link>
		
		<dc:creator><![CDATA[Josh Bryant]]></dc:creator>
		<pubDate>Fri, 02 Sep 2011 23:24:26 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Server 2008 R2]]></category>
		<guid isPermaLink="false">http://www.fixtheexchange.com/configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart/</guid>

					<description><![CDATA[<p>Today at work I had to partition, format, and label, 193 disks, in Server 2008 R2. Each disk was a LUN on an EMC SAN. The server is an HP ProLiant BL460c G7 Server Blade. This will be an Exchange 2010 mailbox server that is part of a Database Availability Group (DAG) when it is [&#8230;]</p>
<p>The post <a href="https://www.fixtheexchange.com/2011/09/02/configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart/">Configuring 193 disks in under 2 minutes with PowerShell and diskpart.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Today at work I had to partition, format, and label, 193 disks, in Server 2008 R2.  Each disk was a LUN on an EMC SAN.  The server is an <a href="http://www.jdoqocy.com/click-5436907-10913059?url=http%3A%2F%2Fhpsmb.rdr.channelintelligence.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1VYQxVqFm4XYxxOAgRKbWYTUFhBFmxDczhqAgcfAgduY09UUUEUZAsXH2UOODtZRkAKF3A6WFJbQhdwUzQzZANaQB5aMD9ABxgHTixabCA2S1NFXURxMxwTVANAOVoZXEstIjpKFGBCWjsnDBcnGk87bSd5Zx4DFnZXMjsDGiIXHG0NdnR1b1NDVWgWFlJQX0oZaRlXXBkAChZ5FFpFVS87C14OC34sFnp1Y3JRXlVNcCEKER0WUzpeNyU1SFdUbkM6IBkGGQAHLU1HXEsnIW5OW1lvCTw*BgYFB0g6C31iMF1cU19SOm9TAAcaQjVWJ2tt%26nAID%3D11138&#038;cjsku=630442-S01" target="_top">HP ProLiant BL460c G7 Server Blade</a><img loading="lazy" decoding="async" src="http://www.lduhtrp.net/image-5436907-10913059" width="1" height="1" border="0"/>.  This will be an Exchange 2010 mailbox server that is part of a Database Availability Group (DAG) when it is finished, so 94 of these disks are for databases and 94 are for transaction logs.</p>
<p>5 of the disks received drive letters, the remaining 188 are to be volume mount points.  There was no way I was going to do any of this manually, so I created some PowerShell scripts that use the diskpart command to do all the work for me.  The result is having 5 disks partitioned, formatted, labeled and drive letters assigned.  Then 188 folders get created for use as the volume mount points.  The remaining 188 disks get partitioned, formatted, and labeled.   I&#8217;m still trying to work out a way to script mapping the volume mount points to the folders, so this is a work in progress.  (UPDATED: <a href="http://www.fixtheexchange.com/creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart/">Click here to see how I solved this problem.</a>)</p>
<p>First we have the primarydrives.txt script for diskpart to create the main drives that actually have letters assigned to them:<br />
<code><br />
select disk 3<br />
create partition primary NOERR<br />
format FS=NTFS LABEL="SAN Exchange" UNIT=64K QUICK NOWAIT NOERR<br />
assign letter=D NOERR<br />
select disk 4<br />
create partition primary NOERR<br />
format FS=NTFS LABEL="SAN Temp" UNIT=64K QUICK NOWAIT NOERR<br />
assign letter=T NOERR<br />
select disk 196<br />
create partition primary NOERR<br />
format FS=NTFS LABEL="SAN Tracking Logs" UNIT=64K QUICK NOWAIT NOERR<br />
assign letter=M NOERR<br />
select disk 5<br />
create partition primary NOERR<br />
format FS=NTFS LABEL="SAN Databases" UNIT=64K QUICK NOWAIT NOERR<br />
assign letter=E NOERR<br />
select disk 6<br />
create partition primary NOERR<br />
format FS=NTFS LABEL="SAN Exchange" UNIT=64K QUICK NOWAIT NOERR<br />
assign letter=L NOERR<br />
</code></p>
<p>Next we have the fvmpcreate.ps1 script that creates folders based on names in a text file.  I had a spreadsheet with what the database names are going to be, so I just copied those to the text file to use for this script.  This script also writes a text file for use by diskpart to partition, format, and label each disk.   Like I said, I&#8217;m still working on how to get it to map the volume mount points to the folders created by the script.<br />
<code><br />
# Folder and Volume Mount Point Creation Script<br />
# By Josh M. Bryant<br />
# www.fixtheexchange.com<br />
# Last Updated 9/2/2011 3:40 PM<br />
#<br />
$dbfile = "C:Scriptsdbdrives.txt"<br />
$logfile = "C:Scriptslogdrives.txt"<br />
$dbdata = Get-Content C:Scriptsdbnames.txt<br />
$ldata = Get-Content C:Scriptslognames.txt<br />
$dbpath = "E:EXCH10"<br />
$logpath = "L:EXCH10"<br />
$drive = 6<br />
#<br />
#Create Database Folders and Volume Mount Points<br />
#<br />
ForEach ($line in $dbdata)<br />
{$drive = $drive + 1<br />
New-Item $dbpath$line -type directory<br />
add-content -path $dbfile -value "select disk $drive"<br />
add-content -path $dbfile -value "create partition primary NOERR"<br />
add-content -path $dbfile -value "format FS=NTFS LABEL=`"$line`" UNIT=64K QUICK NOWAIT NOERR"<br />
}<br />
#<br />
#Create Log Folders and Volume Mount Points<br />
#<br />
ForEach ($line in $ldata)<br />
{$drive = $drive + 1<br />
New-Item $logpath$line -type directory<br />
add-content -path $logfile -value "select disk $drive"<br />
add-content -path $logfile -value "create partition primary NOERR"<br />
add-content -path $logfile -value "format FS=NTFS LABEL=`"$line`" UNIT=64K QUICK NOWAIT NOERR"<br />
}<br />
</code></p>
<p>The last script I called createdrives.ps1, this is the master script that calls all the others.<br />
<code><br />
# Exchange Drive Creation Script<br />
# By Josh M. Bryant<br />
# www.fixtheexchange.com<br />
# Last Updated 9/2/2011 3:55 PM<br />
#<br />
# Create primary drives.<br />
diskpart /s C:Scriptsprimarydrives.txt > primarydrives.log<br />
# Wait for disks to format.<br />
sleep 30<br />
# Create EXCH10 Folders<br />
New-Item E:EXCH10 -type directory<br />
New-Item L:EXCH10 -type directory<br />
# Create Folders and Diskpart Scripts<br />
& "C:Scriptsfvmpcreate.ps1"<br />
# Create Volume Mount Points for Databases<br />
diskpart /s C:Scriptsdbdrives.txt > dbdrives.log<br />
# Create Volume Mount Points for Logs<br />
diskpart /s C:Scriptslogdrives.txt > logdrives.log<br />
</code></p>
<p>This ended up being a huge time saver.  Everything completed in about 2 minutes.   Even if I can&#8217;t figure out how to script out the volume mount point mapping, it will have saved me a tremendous amount of time.   The best part is this is scalable, so I can easily adapt it for use on other servers, regardless of the number of disks that need to be configured.</p>
<p>UPDATE: <a href="http://www.fixtheexchange.com/creating-188-volume-mount-points-in-under-2-minutes-with-powershell-and-diskpart/">Click here to see how I solved the volume mount point creation.</a></p>
<p>If you use these scripts, or want to re-post them anywhere else, please keep the author information at the top of the script, and include a link back to this site.  Thanks!</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img loading="lazy" decoding="async" src="https://www.fixtheexchange.com/wp-content/uploads/2025/12/4000px_transparent-scaled.png" width="100"  height="100" alt="" itemprop="image"></div><div class="saboxplugin-authorname"><a href="https://www.fixtheexchange.com/author/josh/" class="vcard author" rel="author"><span class="fn">Josh Bryant</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Cybersecurity Product Leader and internationally recognized Speaker at several Information Security conferences and events with over 26 years of experience as a proven leader in Cybersecurity, Product Management, Threat Hunting, Incident Response, IT Management, IT Architecture, IT Operations, IT Engineering, and Messaging Systems, on a global scale, across a diverse set of industries in both the Public and Private sectors.</p>
</div></div><div class="saboxplugin-web "><a href="http://192.168.2.21:30040" target="_self" >192.168.2.21:30040</a></div><div class="clearfix"></div><div class="saboxplugin-socials sabox-colored"><a title="Linkedin" target="_self" href="https://www.linkedin.com/in/josh-m-bryant/" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-linkedin" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 7.6-0.4 15.2-1 22.6-0.2 2.2-0.4 4.4-0.7 6.6-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7 0 0.3-0.1 0.6-0.2 0.9-0.2 1-0.4 1.9-0.5 2.9-0.2 0.8-0.4 1.6-0.5 2.5-0.1 0.3-0.1 0.5-0.2 0.8-0.7 3.3-1.5 6.5-2.3 9.7-0.6 2.3-1.2 4.5-1.9 6.8-1.5 5.3-3.2 10.5-5 15.6-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2c-0.2 0-0.3 0.1-0.5 0.1l-3 0.6c-1.8 0.3-3.6 0.6-5.4 0.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#0077b5" /><path class="st1" d="m485 335.5c-26.7 73.9-87.3 131.6-163.2 154.2-3 0.9-6.1 1.8-9.2 2.6-1.5 0.4-3 0.8-4.5 1.1-3.6 0.9-7.2 1.6-10.9 2.3h-0.2l-148.3-148.1 35.3-142.9-32-37.6 38.1-38.7 68 68.4h11.9l9.5 9.3 70.5-3.9 135 133.3z" /><path class="st2" d="m195.6 347.6h-46.9v-150.8h46.9v150.8zm-23.5-171.4c-15 0-27.1-12.4-27.1-27.4s12.2-27.1 27.1-27.1c15 0 27.1 12.2 27.1 27.1s-12.1 27.4-27.1 27.4zm198.9 171.4h-46.8v-73.4c0-17.5-0.4-39.9-24.4-39.9-24.4 0-28.1 19-28.1 38.7v74.7h-46.8v-150.9h44.9v20.6h0.7c6.3-11.9 21.5-24.4 44.3-24.4 47.4 0 56.1 31.2 56.1 71.8l0.1 82.8z" /></svg></span></a><a title="Twitter" target="_self" href="https://x.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-twitter" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 148 148">
  <path d="M 63.907 0.948 C 37.893 3.663 14.65 20.788 4.083 45.024 C -2.727 60.67 -3.86 78.686 0.975 95.272 C 6.947 115.953 22.396 133.424 42.387 142.162 C 58.034 148.972 76.05 150.106 92.636 145.27 C 117.461 138.113 137.009 117.731 143.424 92.408 C 153.443 52.724 128.862 12.148 89.079 2.675 C 80.342 0.602 72.646 0.058 63.907 0.948 Z M 64.893 46.801 C 71.21 55.192 76.544 62.103 76.741 62.103 C 76.938 62.103 83.504 55.192 91.252 46.801 L 105.419 31.5 L 113.463 31.5 L 111.735 33.328 C 110.749 34.361 104.332 41.322 97.47 48.775 C 90.61 56.229 83.898 63.483 82.563 64.817 L 80.194 67.334 L 98.705 91.965 C 108.874 105.538 117.215 116.789 117.215 116.99 C 117.215 117.238 111.145 117.383 103.787 117.383 L 90.314 117.334 L 77.777 100.553 C 69.14 88.954 65.092 83.965 64.697 84.265 C 64.401 84.512 57.39 92.065 49.1 101.046 L 34.045 117.383 L 30.242 117.383 C 28.122 117.383 26.395 117.283 26.395 117.138 C 26.395 116.99 34.243 108.398 43.816 98.084 C 53.345 87.768 61.243 79.131 61.339 78.984 C 61.391 78.784 53.542 68.074 43.918 55.192 C 34.293 42.359 26.395 31.747 26.395 31.646 C 26.395 31.55 32.465 31.5 39.919 31.5 L 53.442 31.5 L 64.893 46.801 Z M 64.893 46.801" />
  <path d="M 38.588 38.114 C 38.784 38.459 51.22 55.142 66.128 75.082 L 93.276 111.411 L 99.344 111.461 C 103.098 111.461 105.368 111.263 105.267 110.966 C 105.222 110.721 92.832 94.04 77.827 73.949 L 50.48 37.423 L 44.361 37.423 C 39.279 37.423 38.242 37.524 38.589 38.114 L 38.588 38.114 Z M 38.588 38.114" />
</svg></span></a><a title="Github" target="_self" href="https://github.com/FixTheExchange" rel="nofollow noopener" class="saboxplugin-icon-color"><svg class="sab-github" viewBox="0 0 500 500.7" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="st0" d="m499.8 250.7c0 9.9-0.6 19.7-1.7 29.2-0.1 0.6-0.1 1.1-0.2 1.7-0.3 2.6-0.7 5.2-1.1 7.7-0.4 2.3-0.8 4.7-1.2 7-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9-0.2 0-0.3 0.1-0.5 0.1-0.9 0.1-1.9 0.3-2.8 0.4-5.5 0.8-11.1 1.3-16.7 1.7-0.8 0.1-1.6 0.1-2.4 0.1-5 0.3-10.1 0.4-15.2 0.4-137.7 0-249.3-111.6-249.3-249.3s111.6-249.4 249.3-249.4 249.3 111.7 249.3 249.4z" fill="#4078c0" /><path class="st1" d="m495.6 296.3c-0.2 1.3-0.5 2.5-0.7 3.8-0.2 1.1-0.5 2.2-0.7 3.3-1.2 5.6-2.6 11-4.2 16.5-23.4 81.3-87.1 145.6-168.2 169.8-4.5 1.3-9.1 2.6-13.7 3.7-6.5 1.6-13.2 2.8-20 3.9l-140.4-141.1-14.9-35.9-7.8-71 32.6-89.2 79.9-17.7 111.5 7.2 146.6 146.7z" /><path class="st2" d="m204 339c0 1.2-1.3 2.1-3 2.1-1.9 0.2-3.3-0.8-3.3-2.1 0-1.2 1.3-2.1 3-2.1 1.8-0.1 3.3 0.8 3.3 2.1zm-18.1-2.6c-0.4 1.2 0.8 2.5 2.5 2.8 1.5 0.6 3.3 0 3.6-1.2s-0.8-2.5-2.5-3c-1.5-0.3-3.2 0.3-3.6 1.4zm25.7-1c-1.7 0.4-2.8 1.5-2.7 2.8 0.2 1.2 1.7 1.9 3.4 1.5s2.8-1.5 2.7-2.7c-0.2-1-1.7-1.7-3.4-1.6zm38.2-222.8c-80.6 0-142.3 61.2-142.3 141.9 0 64.5 40.6 119.7 98.5 139.1 7.4 1.3 10.1-3.3 10.1-7 0-3.6-0.2-23.5-0.2-35.7 0 0-40.7 8.7-49.2-17.3 0 0-6.6-16.9-16.2-21.3 0 0-13.3-9.1 0.9-9 0 0 14.5 1.2 22.4 15 12.7 22.4 34.1 16 42.4 12.2 1.3-9.3 5.1-15.8 9.3-19.6-32.5-3.6-65.3-8.3-65.3-64.2 0-16 4.4-24 13.7-34.2-1.5-3.8-6.5-19.4 1.5-39.5 12.2-3.8 40.1 15.7 40.1 15.7 11.6-3.3 24.1-4.9 36.5-4.9s24.9 1.7 36.5 4.9c0 0 28-19.5 40.1-15.7 8 20.2 3 35.7 1.5 39.5 9.3 10.3 15 18.3 15 34.2 0 56.1-34.2 60.6-66.7 64.2 5.3 4.6 9.9 13.3 9.9 27 0 19.6-0.2 43.8-0.2 48.6 0 3.8 2.7 8.4 10.1 7 58.1-19.3 97.6-74.5 97.6-139 0.1-80.6-65.3-141.9-146-141.9zm-85.8 200.6c-0.8 0.6-0.6 1.9 0.4 3 0.9 0.9 2.3 1.3 3 0.6 0.8-0.6 0.6-1.9-0.4-3-0.9-1-2.2-1.4-3-0.6zm-6.3-4.7c-0.4 0.8 0.2 1.7 1.3 2.3 0.9 0.6 2.1 0.4 2.5-0.4s-0.2-1.7-1.3-2.3c-1.1-0.4-2-0.2-2.5 0.4zm18.9 20.7c-0.9 0.8-0.6 2.5 0.8 3.6 1.3 1.3 3 1.5 3.8 0.6 0.8-0.8 0.4-2.5-0.8-3.6-1.3-1.4-3.1-1.6-3.8-0.6zm-6.6-8.6c-0.9 0.6-0.9 2.1 0 3.4s2.5 1.9 3.3 1.3c0.9-0.8 0.9-2.3 0-3.6s-2.4-1.8-3.3-1.1z" /></svg></span></a></div></div></div><p>The post <a href="https://www.fixtheexchange.com/2011/09/02/configuring-193-disks-in-under-2-minutes-with-powershell-and-diskpart/">Configuring 193 disks in under 2 minutes with PowerShell and diskpart.</a> first appeared on <a href="https://www.fixtheexchange.com">Fix The Exchange!</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
