<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Datastore Mount/Unmount Detach/Attach functions in VMware PowerCLI Documents</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/ta-p/2791968</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A set of functions to allow you to unmount/mount and detach/attach datastores from multiple hosts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List all datastores and their mount/detach status by passing your datastore object(s) into the Get-DatastoreMountInfo advanced function as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;span class="lia-inline-image-display-wrapper" image-alt="List.jpg"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/35869i7F33235C8A1E5BAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="List.jpg" alt="List.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To unmount a datastore pass your datastore object(s) to the Unmount-Datastore advanced function as seen below, this will unmount the datastore from all attached hosts:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;span class="lia-inline-image-display-wrapper" image-alt="Unmount.jpg"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/35870i76E828EE8D449F30/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unmount.jpg" alt="Unmount.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once unmounted you will then be able to detach the datastore from the hosts using the Detach-Datastore cmdlet as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Detach.jpg"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/35871i7284F1C3A97397B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Detach.jpg" alt="Detach.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jan 2012 17:47:33 GMT</pubDate>
    <dc:creator>alanrenouf</dc:creator>
    <dc:date>2012-01-11T17:47:33Z</dc:date>
    <item>
      <title>Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/ta-p/2791968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A set of functions to allow you to unmount/mount and detach/attach datastores from multiple hosts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List all datastores and their mount/detach status by passing your datastore object(s) into the Get-DatastoreMountInfo advanced function as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;span class="lia-inline-image-display-wrapper" image-alt="List.jpg"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/35869i7F33235C8A1E5BAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="List.jpg" alt="List.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To unmount a datastore pass your datastore object(s) to the Unmount-Datastore advanced function as seen below, this will unmount the datastore from all attached hosts:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;span class="lia-inline-image-display-wrapper" image-alt="Unmount.jpg"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/35870i76E828EE8D449F30/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unmount.jpg" alt="Unmount.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once unmounted you will then be able to detach the datastore from the hosts using the Detach-Datastore cmdlet as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Detach.jpg"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/35871i7284F1C3A97397B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Detach.jpg" alt="Detach.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 17:47:33 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/ta-p/2791968</guid>
      <dc:creator>alanrenouf</dc:creator>
      <dc:date>2012-01-11T17:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791969#M270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice functions, come in very handy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 06:06:54 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791969#M270</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2012-01-12T06:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791970#M271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 00:48:04 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791970#M271</guid>
      <dc:creator>alanrenouf</dc:creator>
      <dc:date>2012-01-13T00:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791971#M272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to detach by the NAA number if a vmfs hadn't been created yet?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 12:56:24 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791971#M272</guid>
      <dc:creator>markdjones82</dc:creator>
      <dc:date>2012-09-27T12:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791972#M273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at &lt;A href="http://www.lucd.info/2011/11/25/lun-juggling-in-vsphere-5/"&gt;LUN juggling in vSphere 5&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 13:02:03 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791972#M273</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2012-09-27T13:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791973#M274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is very helpful - thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have unmounted and detached the datastore and confirmed that they display as dismounted and detached ( via Get-Datastore storename | Get-DataStoreMountInfo).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i remove the assignment from my SAN (HP P4000) we still get alerts along the line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[VMware vCenter - Alarm alarm.StorageConnectivityAlarm] Alarm 'Cannot connect to storage' on vmware2.company.com changed from Red to Green.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in vSphere client they show with the red alarm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried rescanning first, but, same effect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this the expected outcome - i was hoping for a "quieter" disconnect.&amp;nbsp; Does this happen to anyone else?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 13:00:32 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791973#M274</guid>
      <dc:creator>jim7</dc:creator>
      <dc:date>2012-10-25T13:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791974#M275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the script and got a problem/interrogation : only the first lun (extent) of a DataStore is checked by &lt;EM&gt;Get-DataStoreMountInfo&lt;/EM&gt; and detached by &lt;EM&gt;Detach-Datastore&lt;/EM&gt; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $hostviewDSDiskName = $ds.ExtensionData.Info.vmfs.&lt;STRONG&gt;extent[0]&lt;/STRONG&gt;.diskname&lt;/P&gt;&lt;P&gt;By using something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $hostviewDSDiskNames = $ds | %{ $_.ExtensionData.Info.vmfs.extent | %{$_.DiskName} }&lt;/P&gt;&lt;P&gt;instead and modifying the equality test for devices :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #if ($device.canonicalName -eq $hostviewDSDiskName) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;to something like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($hostviewDSDiskNames -contains $device.canonicalName) {&lt;/P&gt;&lt;P&gt;ie. testing if the current device is one of the extents forming the DataStore, shouldn't it work better ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If having serveral LUN in a DS, may it explain&amp;nbsp; getting StorageConnectivityAlarm ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 15:57:15 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791974#M275</guid>
      <dc:creator>cols</dc:creator>
      <dc:date>2012-11-23T15:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791975#M276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very handy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for sharing ! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 17:21:19 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791975#M276</guid>
      <dc:creator>yonish</dc:creator>
      <dc:date>2014-05-29T17:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791976#M277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Love these functions but when running the Unmount I get the following errors -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exception calling "UnmountVmfsVolume" with "1" argument(s): "Cannot complete&lt;/P&gt;&lt;P&gt;the operation due to an incorrect request to the server."&lt;/P&gt;&lt;P&gt;At C:\Users\Chris\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:&lt;/P&gt;&lt;P&gt;137 char:6&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;$StorageSys.UnmountVmfsVolume($DS.ExtensionData.Info.vmfs.uuid);&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + CategoryInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : NotSpecified: (:) [], MethodInvocationException&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + FullyQualifiedErrorId : VimException&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had this code in my Powershell Profile and also in a PS1 file alone with the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 19:48:40 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791976#M277</guid>
      <dc:creator>cchilderhose528</dc:creator>
      <dc:date>2014-06-24T19:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791977#M278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;nice function..very helpful while performing any storage maintenance..I need few more work around on this.. Is it possible to skip unmount/detach the lun where vms running cluster..For example..&lt;/P&gt;&lt;P&gt;if&amp;nbsp; a single lun is mapped to three clusters in a data center&amp;nbsp; but In only one cluster vms are running and rest of two clusters there is only connectivity..now if I execute the above function it should skip the cluster where vms running and unmount rest of two clusters..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 17:57:33 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791977#M278</guid>
      <dc:creator>vin01</dc:creator>
      <dc:date>2014-06-26T17:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791978#M279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Very Nice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to unmounts just 1 host?&amp;nbsp; I have the datastore shared by many hosts and only want to remove it from a select few not all of them that are connected to it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 21:09:58 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791978#M279</guid>
      <dc:creator>habs3</dc:creator>
      <dc:date>2014-07-25T21:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791979#M280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;Below are &lt;SPAN class="currentHitHighlight" style="color: #ffffff; background-color: #ed8043;"&gt;best&lt;/SPAN&gt; &lt;SPAN class="highlight" style="background-color: #ffee94;"&gt;practices&lt;/SPAN&gt; to unmount datastore from &lt;STRONG&gt;vCenter&lt;/STRONG&gt;. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;Below checks should be considered.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;-No VM resides on the datastore&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;-The datastore is not part of Datastore cluster&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;-The datastore is not managed by storage DRS&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;-SIOC is disabled for this datastore&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;-The datastore is not used for vSphere HA heartbeat. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size: 10pt;"&gt;It seems, Unmount API itself does not do these checks, We need to &lt;/SPAN&gt;&lt;SPAN style="color: #3366ff; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;explicitly handle these checks in script.&lt;/SPAN&gt;&lt;SPAN style="color: #3366ff; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;&lt;STRONG&gt;From ESXi host&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;&lt;STRONG&gt;- &lt;/STRONG&gt;Only check feasible is &lt;STRONG&gt;: &lt;/STRONG&gt;-No VM resides on the datastore&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"&gt;-Remaining checks are not easy to code if we want to unmount from ESXI directly. The reason is ESXi can not know weather SIOC/SDRS etc are enabled.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;-If you have to unmount from ESXi, you first should check either manaully or pro-&lt;/SPAN&gt;grammatically&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; from VC&amp;nbsp; &amp;amp; if everything is OK, finally unmount/detach the datastore from ESXi&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 15px;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;I went through this script, this script will work fine BUT there is NO any &lt;/SPAN&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif;"&gt;aforementioned checks. Hence please be cautious while using this script.&lt;/SPAN&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;&amp;nbsp; If you do not consider these check &amp;amp; run this script on datacenter where multiple hosts/datastores/datastore clusters are there, it may lead to some implications. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;To answer your question: Same script work even to unmount datastore from ESXi. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;Steps: Save this script as .ps1 (powershell) &amp;gt;&amp;gt;add the datastore name to be unmounted in script&amp;gt;&amp;gt;run this script from powershell (make sure POwerCLI is also installed in the same system)&amp;gt;&amp;gt;it will ask you for credential&amp;gt;&amp;gt;add your ESXi credentials&amp;gt;&amp;gt; it should work to unmount from your host.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #282828; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; font-size: 10pt;"&gt;I re-iterate, plz make sure you consider all checks I mentioned above.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jul 2014 04:36:09 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791979#M280</guid>
      <dc:creator>vThinkBeyondVM</dc:creator>
      <dc:date>2014-07-26T04:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791980#M281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;B&gt;habs3&lt;/B&gt;-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I replied to your thread at &lt;A _jive_internal="true" href="https://communities.vmware.com/message/2408628#2408628" title="https://communities.vmware.com/message/2408628#2408628"&gt;https://communities.vmware.com/message/2408628#2408628&lt;/A&gt; about acting on datastores/LUNs for a single host (instead of all hosts associated with the datastore/LUN).&amp;nbsp; I included in said thread an updated version of the functions that &lt;A _jive_internal="true" href="https://communities.vmware.com/people/alanrenouf"&gt;Alan&lt;/A&gt; posted on this page.&amp;nbsp; Let us know if those functions serve your need.&amp;nbsp; If so, maybe we'll attach the updated functions at this doc page, too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 02:30:38 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791980#M281</guid>
      <dc:creator>mattboren</dc:creator>
      <dc:date>2014-07-28T02:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791981#M282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please advice me how to use this function i tired but not able to use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI&amp;gt; C:\Users\murti\Desktop\DatastoreFunctions.ps1&lt;/P&gt;&lt;P&gt;PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI&amp;gt; Get-DatastoreMountInfo&lt;/P&gt;&lt;P&gt;Get-DatastoreMountInfo : The term 'Get-DatastoreMountInfo' is not recognized as the name of a cmdlet, function, script file, or operable program.&lt;/P&gt;&lt;P&gt;Check the spelling of the name, or if a path was included, verify that the path is correct and try again.&lt;/P&gt;&lt;P&gt;At line:1 char:1&lt;/P&gt;&lt;P&gt;+ Get-DatastoreMountInfo&lt;/P&gt;&lt;P&gt;+ ~~~~~~~~~~~~~~~~~~~~~~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + CategoryInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : ObjectNotFound: (Get-DatastoreMountInfo:String) [], CommandNotFoundException&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + FullyQualifiedErrorId : CommandNotFoundException&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Sep 2014 06:19:26 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791981#M282</guid>
      <dc:creator>rammurt84</dc:creator>
      <dc:date>2014-09-28T06:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791982#M283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. You will have to execute this script using Powershell. (Internally PowerCLI will come in picture ).&amp;nbsp; &lt;/P&gt;&lt;P&gt;2. You need to call appropriate function in the script (You can find at the end of the script there are some calls made . &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ex.&amp;nbsp; Get-Datastore IX2ISCSI01(Pass you datastore name here) | Unmount-Datastore&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Remove the comments)&lt;/P&gt;&lt;P&gt;3. Follow below best practices before going forward.&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;Below are &lt;SPAN class="currentHitHighlight" style="font-weight: inherit; font-style: inherit; font-size: inherit !important; font-family: inherit; color: #ffffff; background-color: #ed8043;"&gt;best&lt;/SPAN&gt; &lt;SPAN class="highlight" style="font-weight: inherit; font-style: inherit; font-size: inherit !important; font-family: inherit; background-color: #ffee94;"&gt;practices&lt;/SPAN&gt; to unmount datastore from &lt;STRONG style="font-style: inherit; font-size: inherit; font-family: inherit;"&gt;vCenter&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;Below checks should be considered.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;-No VM resides on the datastore&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;-The datastore is not part of Datastore cluster&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;-The datastore is not managed by storage DRS&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;-SIOC is disabled for this datastore&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2px; font-size: 15px; font-family: 'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif; color: #282828;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; color: #3366ff;"&gt;-The datastore is not used for vSphere HA heartbeat.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Sep 2014 08:52:25 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791982#M283</guid>
      <dc:creator>vThinkBeyondVM</dc:creator>
      <dc:date>2014-09-28T08:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791983#M284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is great. Automated 70 operations with this.. and another 500 to go tomorrow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It could do with a -RunAsync option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 21:47:31 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2791983#M284</guid>
      <dc:creator>daunce</dc:creator>
      <dc:date>2014-10-23T21:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Mount/Unmount Detach/Attach functions</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2873727#M333</link>
      <description>&lt;P&gt;Does not work againts vSphere 7 for some reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 09:36:40 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Mount-Unmount-Detach-Attach-functions/tac-p/2873727#M333</guid>
      <dc:creator>perttisaa</dc:creator>
      <dc:date>2021-10-22T09:36:40Z</dc:date>
    </item>
  </channel>
</rss>

