Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Hudu-LAPSAlternative-Documentation.ps1 #26

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CyberdrainRewrite/Hudu-LAPSAlternative-Documentation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ New-HuduAPIKey $HuduAPIKey
New-HuduBaseUrl $HuduBaseDomain

$Company = Get-HuduCompanies -name $CompanyName

if($company){}
else{
$Company = Get-HuduCompanies | where {$_.name -eq $CompanyName }
}


if ($company) {
#This is the data we'll be sending to Hudu

Expand Down
15 changes: 13 additions & 2 deletions MSP360_To_Hudu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,24 @@ foreach ($job in $BackupJobs) {

#First lets check for the company
$company = Get-HuduCompanies -Name $job.CompanyName

if($company){}
else{
$Company = Get-HuduCompanies | where {$_.name -eq $job.CompanyName }
}


if ($company) {
Write-Host "Company $($job.CompanyName) found in Hudu" -ForegroundColor Green

#Check if there is a detailed report and if there is download it
$reportlink = $job.DetailedReportLink
if ($reportlink){
$detailedReport = Invoke-WebRequest $reportlink
$detailedReport = Invoke-WebRequest $reportlink -UseBasicParsing
}
else
{
$detailedReport = $null
}

#Make data human readable
Expand Down Expand Up @@ -248,7 +259,7 @@ foreach ($job in $BackupJobs) {
$null = $job_fields.add('error_message', $($processedJob.ErrorMessage).toString())
}
if ($detailedReport) {
$null = $job_fields.add('detailed_report', $($processedJob).toString())
$null = $job_fields.add('detailed_report', $($detailedReport).toString())
}


Expand Down