generated from VeeamHub/veeamhub-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
3,766 additions
and
1,063 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
vHC/HC_Reporting/Functions/Collection/PSCollections/CScripts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace VeeamHealthCheck.Functions.Collection.PSCollections | ||
{ | ||
internal class CScripts | ||
{ | ||
public CScripts() | ||
{ | ||
//RunPsScript(GetJobInfo()); | ||
//RunPsScript("Get-VBRJob"); | ||
//RunPsScript(File.ReadAllText(Environment.CurrentDirectory + @"\Tools\Scripts\Get-VBRConfig.ps1")); | ||
} | ||
//script to get vbr-job info | ||
public string GetJobInfo() | ||
{ | ||
string script = @" | ||
Connect-VBRServer -Server localhost | ||
$jobs = Get-VBRJob | ||
$piJob = Get-VBRPluginJob | ||
$jobInfo = @() | ||
foreach ($job in $jobs) | ||
{ | ||
$jobInfo += $job | ||
} | ||
$jobInfo | ||
"; | ||
return script; | ||
} | ||
|
||
//script to get job information from Veeam PowerShell | ||
//write a powershell script to save job information in a custom object containing members: jobName, jobType, sourceSizeUsedGB, sourceSizeProvisionedGb, Repository, daysOrPoints, retentionValue, GfsEnabled, GfsWeeklyCount, GfsMonthlyCount, GfsYearlyCount, SyntheticEnabled, ActiveFullEnabled, SyntheticDays, ActiveFullDays, compressionLevel, BlockSize, Encrypted, IndexingEnabled, schedule | ||
|
||
//execute powershell script returned from GetJobInfo() method | ||
|
||
private void RunPsScript(string script) | ||
{ | ||
using (PowerShell ps = PowerShell.Create()) | ||
{ | ||
ps.AddScript(script); | ||
ps.AddParameter("VBRServer", "localhost");//.AddParameter("localhost"); | ||
ps.AddParameter("VBRVersion", "12");//.AddParameter("12"); | ||
var results = ps.Invoke(); | ||
foreach (var result in results) | ||
{ | ||
//do something with the results | ||
Console.WriteLine(result); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.