Automation

 View Only
  • 1.  Detach unused RDMs from ESXi Cluster

    Posted Feb 12, 2018 12:42 PM

    Hi,

    I am issues detaching unused RDMs from ESXi Cluster.

    I am using below script and getting error

    Connect-viserver 10.10.10.10

    $lun = "naa.60a98000424c7841583f4a596b73556e"

    Get-Cluster -Name My-Compute | Get-VMHost | %{Detach-Disk -VMHost $_ -CanonicalName $lun}

    Error

    Detach-Disk : The term 'Detach-Disk' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was

    included, verify that the path is correct and try again.

    At D:\detach.ps1:3 char:47

    + Get-Cluster -Name My-Compute | Get-VMHost | %{Detach-Disk -VMHost $_ -CanonicalN ...

    +                                               ~~~~~~~~~~~

        + CategoryInfo          : ObjectNotFound: (Detach-Disk:String) [], CommandNotFoundException

        + FullyQualifiedErrorId : CommandNotFoundException

    Please help...



  • 2.  RE: Detach unused RDMs from ESXi Cluster
    Best Answer

    Posted Feb 12, 2018 12:46 PM

    I guess you might be trying to use the functions I provided in LUN Juggling In VSphere 5.

    You will have to copy those functions in your script, or in a separate file and dot-source that file before running your script.



  • 3.  RE: Detach unused RDMs from ESXi Cluster

    Posted Feb 12, 2018 01:52 PM

    Thanks LuCD, After copying the function into my script, it worked. :smileyhappy: