RoArHa
Contributor
Contributor

(Get-DataStore ) How to find out which Datacenter is using the same datastore

Hi,

A newbie question:

How can I find out which Datacenters are using the same Datastore. 

The command I'am using is:

PS C:\Windows\system32> Get-Datastore -name 'Templates' | where{$_.FileSystemVersion -match "^5."}
Name                               FreeSpaceGB      CapacityGB
----                               -----------      ----------
Templates                              187,471         299,750
Templates                              187,466         299,750
Templates                              187,471         299,750
Templates                              187,466         299,750
 
In the get-member I see Datacenter, but I don't get it correct.
 
Thanks in advance.
 
 
Cheers,
Roberto
0 Kudos
6 Replies
xSyteck
Enthusiast
Enthusiast

$datastore=Get-Datastore nameOrRegex

$datastore | %{if (($_.Datacenter | Measure | Select -ExpandProperty Count) -gt 1) {Write-Host $_.Name" is used by "$_.Datacenter}}

 

You will check for every datastore stored in your variable if they have more than one datacenter in their property Datacenter, if so it will print a sentence with the datastore and its datacenter.

We do not have datastore used by multiple datacenter here so i couldn't test properly 😕

0 Kudos
RoArHa
Contributor
Contributor

Thanks for the fast reply. Much appreciated.

I've excuted the line, but the output is empty. I'll for more info in the meanwhile 🙂

Cheers

0 Kudos
xSyteck
Enthusiast
Enthusiast

Are you sure you have datastore used by multiple datacenter ? If so get a datastore you're sure is used by multiple datacenter and check the datacenter property.

0 Kudos
RoArHa
Contributor
Contributor

Thanks mate.

$datastore=Get-Datastore -Name 'Template'
$datastore | select name, datacenter

I need to figure out more, but this is a good start.

 

Thanks so much.

 

Cheers,

Roberto

0 Kudos
xSyteck
Enthusiast
Enthusiast

Can you check that you have at least one datastore shared between two or more datacenter, I don't think it's possible. Maybe someone could confirm or not my saying 🙂
0 Kudos
LucD
Leadership
Leadership

There are 2 possibilities here afaik.

  1. You have datastores with the same name in different datastores. This does not imply that they are based on the same medium (NFS export, FC  LUN...)
  2. You have datastores in different datacenters, that point to the same medium. That could for example be a NFS export to which you connected a datastore in both datacenters. Note that the datastores do not need to have the same name, even though they are pointing to the same medium


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

0 Kudos