Hello again,
I am working on a diagramming tool for veeam backup and replication using powershell, psgraph and graphviz. So now I am in the process of building the backup proxy infrastructure diagram and I want to know if there is any way to get the vsphere infrastructure hierarchy information through the veeam powershell module. I know I can use Powercli but I want to simplify the code and dependencies.
Currently I can get the information about vcenter, esxi host etc. but I need to know if it is possible to get the full hierarchy (Datacenter, Cluster, Resources Pool etc..).
Any help would be greatly appreciated.
Veeam VBR Backup Proxies *WIP*
Other Examples:
Veeam VBR SOBR:
Veeam VBR Backup Repository:
Veeam VBR Wan Accel:
-
- Veeam Vanguard
- Posts: 44
- Liked: 31 times
- Joined: Dec 30, 2021 1:16 am
- Full Name: Jonathan Colon
- Location: Puerto Rico
- Contact:
Get VMware Datacenter from veeam powershell
Jonathan Colon
https://techmyth.blog/
https://techmyth.blog/
-
- Product Manager
- Posts: 14844
- Liked: 3086 times
- Joined: Sep 01, 2014 11:46 am
- Full Name: Hannes Kasparick
- Location: Austria
- Contact:
Re: Get VMware Datacenter from veeam powershell
Hello,
first of all: fancy output
Best regards,
Hannes
first of all: fancy output
looking at the Veeam PowerShell reference, PowerCLI is the way to go.I know I can use Powercli
Best regards,
Hannes
-
- Service Provider
- Posts: 33
- Liked: 4 times
- Joined: Feb 29, 2012 1:42 pm
- Full Name: EamonnD
- Location: Dublin, Ireland
- Contact:
Re: Get VMware Datacenter from veeam powershell
Hi jcolonfzenpr
Perhaps something in this basic script might help or point you in some direction.
Might need some testing/validation/optimization/dev/corrections etc..
#Edited by MOD: added /code Tags for visability
Perhaps something in this basic script might help or point you in some direction.
Might need some testing/validation/optimization/dev/corrections etc..
Code: Select all
#####################################################
# Eamonn Deering
# A quick attempt to gather vCenter info through Veeam
# 01082022
#
#####################################################
# Eamonn Deering
# A quick attempt to garther vCenter info through Veeam
# 01082022
#
#Create an array
$vCenterServers = @()
# Collect all the vCenter servers mapped to this VBR
$vCenterServers= Get-VBRServer -Type vc
# Display all the vCenter names
Write-Host ""
Write-Host "vCenter Names "
Write-Host "----------------------------"
$vCenterServers.name
# Display systems connected to each vcenter
Foreach ($vCenter in $vCenterServers){
$VMs = Find-VBRViEntity -server $vCenter | where {($_.type -eq "vm")}
$ESXis = Find-VBRViEntity -server $vCenter | where {($_.type -eq "esx")}
$Clusters = Find-VBRViEntity -server $vCenter | where {($_.type -eq "cluster")}
Write-Host ""
Write-Host "vCenter Name "
Write-Host "----------------------------"
$vCenter.name |sort
Write-Host ""
Write-Host "Cluster's in this vCenter "
Write-Host "---------"
$Clusters.Name |sort
$Datastores = Find-VBRViEntity -Server $vCenter -DatastoresAndVMs | where {($_.type -eq "Datastore")}
Write-Host ""
Write-Host "Datastor Names in the vCenter "
Write-Host "--------------"
$Datastores.Name |sort
Write-Host ""
Write-Host "ResourcePools in the vCenter "
Write-Host "--------------"
$ResourcePools = Find-VBRViEntity -Server $vCenter -ResourcePools | where {($_.type -eq "ResourcePool")}|sort path
$ResourcePools | Select Name, Path |Ft
<#
Write-Host ""
Write-Host "ESXi Hosts"
$ESXis.Name |sort
Write-Host ""
#Write-Host "VM Names"
#$Vms.Name
#Write-Host ""
#>
}
foreach ($cluster in $Clusters){
Write-Host " "
Write-Host " "
Write-Host "Cluster Name "
Write-Host "------------ "
$cluster.name
Write-Host ""
Write-Host "ResourcePools in the Cluster "
Write-Host "----------------------------"
$ResourcePools.path -match $cluster.Name |Sort
# Datastore path does not list the Cluster
#Write-Host ""
#Write-Host "Datastor Names in the Cluster "
#Write-Host "--------------"
#$Datastores.path -match $cluster.Name |sort
$ClusterESXis =$ESxis.path -match $cluster.name |sort
$x=1
Foreach ($ESXi in $ClusterESXis |sort){ #$ESXi.split("\")[-1]
Write-Host ""
Write-Host "ESXi Servers in this cluster "$x " Of " $ClusterESXis.count
Write-Host "----------------------------"
$x++
Write-Host ""
Write-Host $ESXi.split("\")[-1]
#$PowerOnVMs = Find-VBRViEntity -server $vCenter | where {($_.VmHostName -match $ESXi.split("\")[-1])} | where {($_.PowerState -eq "PoweredON")}
#$PowerOffVMs = Find-VBRViEntity -server $vCenter | where {($_.VmHostName -match $ESXi.split("\")[-1])} | where {($_.PowerState -eq "PoweredOff")}
$PowerOnVMs = $VMs | where {($_.VmHostName -match $ESXi.split("\")[-1])} | where {($_.PowerState -eq "PoweredON")}
$PowerOffVMs = $VMs | where {($_.VmHostName -match $ESXi.split("\")[-1])} | where {($_.PowerState -eq "PoweredOff")}
Write-host ""
Write-host "Powered on VM's"
Write-Host "----------------"
$PowerOnVMs.name |sort
Write-host ""
Write-host "Powered Off VM's"
Write-Host "----------------"
$PowerOffVMs.name |sort
}
}
##############################################
-
- Veeam Vanguard
- Posts: 44
- Liked: 31 times
- Joined: Dec 30, 2021 1:16 am
- Full Name: Jonathan Colon
- Location: Puerto Rico
- Contact:
Re: Get VMware Datacenter from veeam powershell
Thanks.
This is a good example of the difference between software development and software engineering.
Engineering is the ability to provide solutions to complex problems.
Nice catch!
This is a good example of the difference between software development and software engineering.
Engineering is the ability to provide solutions to complex problems.
Nice catch!
Jonathan Colon
https://techmyth.blog/
https://techmyth.blog/
Who is online
Users browsing this forum: No registered users and 9 guests