Files
management-scripts/rmm/Hudu-DocumentADDS.ps1
2026-10-01 09:39:44 -04:00

32 lines
1.2 KiB
PowerShell

# The following section is by j.mcbride from https://community.syncromsp.com/t/powershell-7-2/7425/5
# Check for required PowerShell version (7+)
if (!($PSVersionTable.PSVersion.Major -ge 7)) {
try {
# Install PowerShell 7 if missing
if (!(Test-Path "$env:SystemDrive\Program Files\PowerShell\7")) {
Write-Output 'Installing PowerShell version 7...'
Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
}
# Refresh PATH
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'User')
# Restart script in PowerShell 7
pwsh -File "`"$PSCommandPath`"" @PSBoundParameters
}
catch {
Write-Output 'PowerShell 7 was not installed. Update PowerShell and try again.'
throw $Error
}
finally { exit $LASTEXITCODE }
}
# Input the actual script below this line
# The rest of this script is by Emberkom
. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
$HuduAPIKey = ''
$HuduBaseDomain = 'https://emberkom.huducloud.com'
$CompanyName = $CName
Run-Script -LivePSScript Hudu-DocumentADDS