<?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>Rule Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/category/vsphere/drs/rule/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/category/vsphere/drs/rule/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Wed, 08 Apr 2020 10:59:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.10</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>Rule Archives - LucD notes</title>
	<link>https://www.lucd.info/category/vsphere/drs/rule/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>DRSRule &#8211; a DRS rules and groups module</title>
		<link>https://www.lucd.info/2015/01/22/drsrule-drs-rules-and-groups-module/</link>
					<comments>https://www.lucd.info/2015/01/22/drsrule-drs-rules-and-groups-module/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Thu, 22 Jan 2015 15:00:14 +0000</pubDate>
				<category><![CDATA[Affinity]]></category>
		<category><![CDATA[Anti-affinity]]></category>
		<category><![CDATA[DRS]]></category>
		<category><![CDATA[Group]]></category>
		<category><![CDATA[Host]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Rule]]></category>
		<category><![CDATA[VM]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[anti-affinity]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[Module]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[rule]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4852</guid>

					<description><![CDATA[One of the nice vSphere features is the ability to define DRS rules. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>One of the nice vSphere features is the ability to define <a href="http://pubs.vmware.com/vsphere-55/topic/com.vmware.vsphere.resmgmt.doc/GUID-FF28F29C-8B67-4EFF-A2EF-63B3537E6934.html" target="_blank" rel="noopener noreferrer">DRS rules</a>.</p>
<p><a href="https://www.lucd.info/2015/01/22/drsrule-drs-rules-and-groups-module/drsrule-intro/" rel="attachment wp-att-4854"><img fetchpriority="high" decoding="async" class="aligncenter wp-image-4854" src="https://lucd.info/wp-content/uploads/2015/01/DRSRule-intro.png" alt="DRSRule-intro" width="490" height="315" srcset="https://www.lucd.info/wp-content/uploads/2015/01/DRSRule-intro.png 659w, https://www.lucd.info/wp-content/uploads/2015/01/DRSRule-intro-300x193.png 300w" sizes="(max-width: 490px) 100vw, 490px" /></a>The feature allows a vSphere administrator to control the placement of virtual machines in a vSphere cluster. There are the <strong>VM to VM</strong> <strong>affinity</strong> and <strong>anti-affinity</strong> rules, and the newer <strong>VM to VMHost</strong> rules. With the VM to VMHost rules, vSphere introduced the concept of <strong>VM</strong> and <strong>VMHost groups</strong>, and the ability to have rules that are a <strong>requirement</strong> (&#8216;shall&#8217;) or a <strong>preference</strong> (&#8216;should&#8217;).</p>
<p>In a recent <a href="https://communities.vmware.com/community/vmtn/automationtools/powercli" target="_blank" rel="noopener noreferrer">VMTN PowerCLI community</a> thread a <a href="https://communities.vmware.com/people/EdZ314" target="_blank" rel="noopener noreferrer">PowerCLI user</a> had a query about <a href="https://communities.vmware.com/message/2271796#2271796" target="_blank" rel="noopener noreferrer">exporting and importing DRS rules and groups</a>. At that point <a href="https://twitter.com/mtboren" target="_blank" rel="noopener noreferrer">Matt Boren</a> and myself developed the idea to provide a PowerShell module. The PowerShell module, which we named <a href="https://github.com/PowerCLIGoodies/DRSRule">DRSRule</a>, provides all the functions we deemed useful for working with DRS rules and groups. And yes, the module includes an <strong>export</strong> and an <strong>import</strong> cmdlet !</p>
<p><span id="more-4852"></span></p>
<p><a href="https://twitter.com/mtboren" target="_blank" rel="noopener noreferrer">Matt Boren</a>, famous for the high quality posts on his <a href="https://www.vnugglets.com/" target="_blank" rel="noopener noreferrer">vNugglets blog</a>, and myself, started working on the module, and after some late evenings and long weekends, we now have a first version we want to make public.</p>
<p>There are already many blogposts on the subject of DRS rules and groups. Including some excellent PowerCLI posts. The first one that springs to mind is <a href="https://twitter.com/avlieshout">Arnim</a>&#8216;s excellent <a href="https://www.van-lieshout.com/2011/06/drs-rules/" target="_blank" rel="noopener noreferrer">Managing VMware DRS rules using PowerCLI</a>.</p>
<p>And don&#8217;t forget to read <a href="https://www.vnugglets.com/2015/01/drsrule-new-powershell-module-for-drs.html">Matt&#8217;s post</a> on the DRSRule module as well.</p>
<p>To get you on your way with the DRSRule module, Matt and myself compiled the following introductory text.</p>
<h2>Why the DRSRule module?</h2>
<p>The core <strong>PowerCLI </strong>from VMware allows for many of the DRS rule operations that one might want to perform.  There have been questions over the years in the <a href="https://communities.vmware.com/community/vmtn/automationtools/powercli" target="_blank" rel="noopener noreferrer">VMware Communities PowerCLI</a> forum about how to export DRS rules and groups, and, on how to then import such items.</p>
<p>While there are several posts on the web about how to get/export such things, importing/recreating DRS rules/groups from such exported data has not received much focus.  This was the spark for this DRSRule module:  to allow for easy export/import of such rules/groups.  As part of making a module to handle these actions, other cmdlets were born, like the <strong>Get-/New-/Remove-/Set-*</strong> cmdlet sets for DRS <strong>VM groups</strong> and <strong>VMHost groups</strong>, along with sets for DRS VM to VM rules and VM to VMHost rules.</p>
<h2>How to use the DRSRule module?</h2>
<p>The DRSRule module comes with an <a href="http://raw.githubusercontent.com/PowerCLIGoodies/DRSRule/master/About_DRSRule.help.txt">about_DRSRule</a>.<br />
Once the module is installed, use that help topic to get a general introduction to the use of the DRSRule module:</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-Help about_DRSRule</pre><p></p>
<h2>How to get the DRSRule module ?</h2>
<p>The source for this PowerShell module is hosted on <a href="https://github.com/">GitHub.com</a>.<br />
The repository is managed by the GitHub organization <a href="https://github.com/PowerCLIGoodies" target="_blank" rel="noopener noreferrer">PowerCLIGoodies</a>, and in there is the <a href="https://github.com/PowerCLIGoodies/DRSRule">DRSRule repository</a> itself.</p>
<p>There are a couple of ways to get the module, and use it in your PowerShell session:</p>
<h3>Automated</h3>
<h4>Via a script</h4>
<p>Use a PowerShell script to perform the download and the extract.<br />
The script is included in the repository as file <a href="https://raw.githubusercontent.com/PowerCLIGoodies/DRSRule/master/DownloadLatest.ps1" target="_blank" rel="noopener noreferrer">DownloadLatest.ps1</a>.</p>
<h4>Via PsGet</h4>
<p>If you have the <a href="https://psget.net/" target="_blank" rel="noopener noreferrer">PsGet</a> module loaded in your PowerShell session, then installing this DRSRule module is as simple as updating PsGet and then installing DRSRule:</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Update-Module -Verbose -Module PsGet
Install-Module DRSRule</pre><p></p>
<h3>Manual</h3>
<p>Grab the <a href="https://github.com/PowerCLIGoodies/DRSRule/archive/Latest.zip" target="_blank" rel="noopener noreferrer">latest version</a> from the GitHub repository.<br />
Extract the content to a suitable folder.</p>
<p>You can go for the Modules folder linked to the Windows account you are using. To find this path, run:</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Join-Path ${env:\userprofile} &quot;Documents\WindowsPowerShell\Modules&quot;)</pre><p></p>
<p>Or you can select any other folder.</p>
<p>Either way you will end up with a folder named <strong>[pathToModule]\DRSRule</strong>, in which the PowerShell files for the <strong>DRSRule module</strong> reside.</p>
<p>Then, load the DRSRule module into your session.</p>
<p>If you selected one of the folders in $env:PSModulePath (your PSModule path), you can do this with</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Import-Module DRSRule</pre><p></p>
<p>If you picked another folder, you should use the full path to the folder that contains the module&#8217;s files, like:</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Import-Module [PathToModule]\DRSRule</pre><p></p>
<p>Please also read the note below about using <strong>Unblock-File</strong>, since this module is not Authenticode signed.</p>
<h2>Note on Unblock-File</h2>
<p>Since there is no <strong>Authenticode</strong> certificate supplied for this module, and, assuming that one&#8217;s PowerShell ExecutionPolicy is at least <strong>RemoteSigned</strong>, below is a quick/easy way to unblock files.  But, this should only be done when you trust the code in the files that you are unblocking &#8212; inspecting the files is for your own good.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-ChildItem [pathToModules]\DRSRule | Unblock-File</pre><p></p>
<p>The DRSRule module was set up as community resource, so we are hoping to see your comments, suggestions and code.</p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2015/01/22/drsrule-drs-rules-and-groups-module/feed/</wfw:commentRss>
			<slash:comments>56</slash:comments>
		
		
			</item>
	</channel>
</rss>
