Automation

 View Only
  • 1.  Sync datastores across hosts

    Posted Dec 02, 2009 09:08 AM

    Hi,

    I'm trying to write a script that will add any NFS datastores missing on a specified host that is present on another specified host and I'm having trouble finding the correct variables from Get-Datastore. In the foreach loop traversing through the datastores on the source host, I can use $_.Name but I also need NFS mount point and server name. I've been trying to find out what Get-Datastore actually returns with Get-Member but it seems the object only contains six properties and none of them points to where the NFS filesystem resides. Is there any built in command to present the entire object and its properties on screen to find these things out?

    Thanks in advance!

    Daniel



  • 2.  RE: Sync datastores across hosts
    Best Answer

    Broadcom Employee
    Posted Dec 11, 2009 09:30 AM

    Hi Daniel!

    You can get more info by using NFS datastore objects's view. Here's an example:

    >$nfsDSView = Get-VMHost -Name

    $nfsDSView.Info.Nas.RemoteHost and $nfsDSView.Info.Nas.RemotePath are the NFS mount values you need

    Irina



  • 3.  RE: Sync datastores across hosts

    Posted Dec 11, 2009 01:40 PM

    Thank you, that works great! About time I started using Get-View, it seems that's where PowerCLI really shines!



  • 4.  RE: Sync datastores across hosts

    Posted Dec 13, 2009 10:09 AM

    With Get-View, one of the two Web Service Access cmdlets, you get access to all the SDK objects with their properties and methods.

    Last Friday I did a short presentation which included using the SDK from PowerCLI.

    See Dutch VMUG event 2009 – The (nearly) lost tapes for the demos I showed there.

    The presentation itself should appear shortly on the Dutch VMUG website.