I would like to automate some task like export my veeam configuration with powershell.
I have a list with all information I would like to obtain on my Enterprise manager :
Licence - socket - instance - agent licence usage - expiration licence date
Version veeam enterprise manager
Veeam managed server connected to EM + account used
vcenters connected to vcenter with version
AD account used for Exchange restore
RBAC what account are used and what roles they have
Is file configuration backup protected with EM
Settings for SAML authentication
SMTP settings
URL EM
URL selfservice
I know a little how powershell works but I never use it with API.
I read Veeam documentation but it's not enough for me to understand how I can do.
I did some research and I found this website with some excellent explanation : http://blog.dewin.me/2016/04/veeam-rest ... shell.html
Unfortunately, I don't understand enough how to do. I tried to find for RBAC to see account with the role but I don't know how to do.
I can find all my account with theses steps but what I have to do after ? :
Code: Select all
$VBEMServerName="veeam.production.lan"
$r_api = Invoke-WebRequest -Method Get -Uri "https://$($VBEMServerName):9398/api/"
$r_api_xml = [xml]$r_api.Content
$r_api_links = "https://$($VBEMServerName):9398/api/sessionMngr/?v=latest"
$r_login = Invoke-WebRequest -method Post -Uri $r_api_links -Credential $credentials
#get session id which we need to do subsequent request
$sessionheadername = "X-RestSvcSessionId"
$sessionid = $r_login.Headers[$sessionheadername]
#content
$r_login_xml = [xml]$r_login.Content
$r_login_links = $r_login_xml.LogonSession.Links.Link
$joblink = "https://$($VBEMServerName):9398/api/security/accounts"
#get jobs with id we have
$r_jobs = Invoke-WebRequest -Method Get -Headers @{$sessionheadername=$sessionid} -Uri $joblink
$r_jobs_xml = [xml]$r_jobs.Content
$r_job = $r_jobs_xml.EntityReferences.Ref
$r_job_alternate = $r_job.links.link
Thanks for your help.