VMware Cloud Community
dnetz
Hot Shot
Hot Shot
Jump to solution

Sync datastores across hosts

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

Reply
0 Kudos
1 Solution

Accepted Solutions
nikol
VMware Employee
VMware Employee
Jump to solution

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

View solution in original post

Reply
0 Kudos
3 Replies
nikol
VMware Employee
VMware Employee
Jump to solution

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

Reply
0 Kudos
dnetz
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference