-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-VeeamRepos.ps1
More file actions
48 lines (42 loc) · 1.78 KB
/
Get-VeeamRepos.ps1
File metadata and controls
48 lines (42 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Add-PSSnapin VeeamPSSnapin
$Session = Get-VBRServerSession | Select *
if($Session.Port -ne $null){
echo "Cool beans, We have an existing session"
$RepoArray = @()
$Repository = @()
$RepoObject = new-object PSObject | select Name, About, DNSName, Spot
$Repository += Get-VBRServer -type Windows
For($a = 0; $a -lt $Repository.count; $a++){
$ErrorActionPreference = "SilentlyContinue"
$RepoObject.Name = $Repository[$a].Info.Name
$RepoObject.About = $Repository[$a].Info.TypeDescription
$RepoObject.DNSName = $Repository[$a].Info.DnsName
$RepoObject.Spot = $a
$RepoObject
$RepoArray += $RepoObject #After hours of tinkering I cannot for the goddamn life of me figure why $RepoArray will not contain the cumulitive data from RepoObject. My current script just displays repoobject and thats it.
}
write-host "#############################"
$RepoArray
write-host "#############################"
}
Elseif($Session.Port -eq $null){
$cred = Get-Credential
Connect-VBRServer -Credential $cred
$RepoArray = @()
$Repository = @()
$RepoObject = new-object PSObject | select Name, About, DNSName, Spot
$Repository += Get-VBRServer -type Windows
For($a = 0; $a -lt $Repository.count; $a++){
$ErrorActionPreference = "SilentlyContinue"
$RepoObject.Name = $Repository[$a].Info.Name
$RepoObject.About = $Repository[$a].Info.TypeDescription
$RepoObject.DNSName = $Repository[$a].Info.DnsName
$RepoObject.Spot = $a
$RepoObject
$RepoArray += $RepoObject #After hours of tinkering I cannot for the goddamn life of me figure why $RepoArray will not contain the cumulitive data from RepoObject. My current script just displays repoobject and thats it.
}
write-host "#############################"
$RepoArray
write-host "#############################"
}
#Disconnect-VBRServer