Update TGBeta.ps1
This commit is contained in:
39
TGBeta.ps1
39
TGBeta.ps1
@@ -217,45 +217,10 @@ function Install-DattoRMM-Helper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add below or near Install-DattoRMM-Helper
|
|
||||||
function Fetch-Sites {
|
|
||||||
param (
|
|
||||||
[string]$ApiUrl = "https://example.com/api/sites", # Replace with your actual API URL
|
|
||||||
[string]$ApiKey = "YourAPIKey", # Replace with your actual API Key
|
|
||||||
[string]$ApiSecretKey = "YourSecretKey" # Replace with your actual Secret Key
|
|
||||||
)
|
|
||||||
|
|
||||||
# Check if Install-DattoRMM exists
|
|
||||||
if (-not (Get-Command -Name Install-DattoRMM -CommandType Function -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Host "Install-DattoRMM function not found. Using helper function." -ForegroundColor Yellow
|
|
||||||
|
|
||||||
# Use the helper function
|
|
||||||
$sites = Install-DattoRMM-Helper -ApiUrl $ApiUrl -ApiKey $ApiKey -ApiSecretKey $ApiSecretKey -FetchSitesOnly
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Using the existing Install-DattoRMM function." -ForegroundColor Green
|
|
||||||
|
|
||||||
# Use the existing function
|
|
||||||
$sites = Install-DattoRMM -ApiUrl $ApiUrl -ApiKey $ApiKey -ApiSecretKey $ApiSecretKey -FetchSitesOnly
|
|
||||||
}
|
|
||||||
|
|
||||||
# Handle the fetched sites
|
|
||||||
if ($sites) {
|
|
||||||
Write-Host "Fetched Sites:" -ForegroundColor Cyan
|
|
||||||
$sites | ForEach-Object {
|
|
||||||
Write-Host "Site Name: $($_.Name), Site UID: $($_.UID)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Failed to fetch sites. Please check your API credentials or connection." -ForegroundColor Red
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region SVS Module
|
#region SVS Module
|
||||||
|
|
||||||
function Install-SVSMSP {
|
function Install-SVSMSP {
|
||||||
|
|||||||
Reference in New Issue
Block a user