-
1. Re: script to fetch datastore details -- vsphere replication
LucD Aug 15, 2017 1:23 PM (in response to Sureshkumar M)Are we talking of the VMware vSphere Replication appliance or SRM?
-
2. Re: script to fetch datastore details -- vsphere replication
Sureshkumar M Aug 16, 2017 4:16 AM (in response to LucD)It is vSphere replication appliance.
-
3. Re: script to fetch datastore details -- vsphere replication
LucD Aug 16, 2017 4:55 AM (in response to Sureshkumar M)I'm afraid there isn't really a way of ding that with PowerCLI.
See also Re: API Guide for vSphere Replication Appliance 6.0.0.1 Build 2718739
-
4. Re: script to fetch datastore details -- vsphere replication
Sureshkumar M Aug 16, 2017 5:08 AM (in response to LucD)Thanks LucD
-
5. Re: script to fetch datastore details -- vsphere replication
Sureshkumar M Aug 25, 2017 11:54 AM (in response to Sureshkumar M)Is there any way to list out the directories under a Datastore.
In order to accomplish the above task, I am planning for this following task. Please suggest
Our secondary site has identical copy of replicated VM in a directory with same name as primary VM. So in case if we list our all the directories from all datastores and export to excel, then we can compare where the replicated data resides.
For that I am looking for a script to list out the folders in datastores.
-
6. Re: script to fetch datastore details -- vsphere replication
LucD Aug 25, 2017 2:43 PM (in response to Sureshkumar M)You can do this
$dsName = 'MyDS'
$ds = Get-Datastore -Name $dsName
New-PSDrive -Name DS -Location $ds -PSProvider VimDatastore -Root '\' | Out-Null
Get-ChildItem -Path DS:
Remove-PSDrive -Name DS
-
7. Re: script to fetch datastore details -- vsphere replication
Sureshkumar M Aug 29, 2017 3:58 AM (in response to LucD)Thanks @LucD, it worked like charm. I tested in my lab.
Little customization needed for reporting purpose
Can you please check if following tasks are possible
1. Now we are giving DS name instead of MyDS, I want this script to fetch all the folders from all datastores from the VC.
2. Output should be in an excel/csv format with columns DS name / foldername / foldersize / lun id (not sure if it populates all in case of more than one extent)
since it is going to give more load on VC, I am bit worried if it cause any issue to vpxd process when we run it on prod machines, can we run this in a batch mode to avoid huge load on VC or adding sleep times in between to make the process cool down. I use to give sleep function in C programming but not sure about powercli.
Thank you very much for your help so far.
Regards,
Suresh
-
8. Re: script to fetch datastore details -- vsphere replication
LucD Aug 29, 2017 9:02 AM (in response to Sureshkumar M)Try like this.
I added a sleep cmdlet after each datastore
$report = foreach($ds in Get-Datastore){
New-PSDrive -Name DS -Location $ds -PSProvider VimDatastore -Root '\' | Out-Null
Get-ChildItem -Path DS:
Remove-PSDrive -Name DS
sleep 30
}
$report | Export-Csv .\report.csv -NoTypeInformation -UseCulture
-
9. Re: script to fetch datastore details -- vsphere replication
Sureshkumar M Sep 1, 2017 5:44 AM (in response to Sureshkumar M)Thank you LucD for your help.