Update powershell/bts-onboarding.ps1
updated directories and trmm installer
This commit is contained in:
parent
a9648a11ab
commit
3e1f089845
1 changed files with 91 additions and 24 deletions
|
@ -30,24 +30,91 @@ function unzip {
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory( $ziparchive, $extractpath )
|
[System.IO.Compression.ZipFile]::ExtractToDirectory( $ziparchive, $extractpath )
|
||||||
}
|
}
|
||||||
|
|
||||||
#Create Support Directories
|
#Create ProgramData\BTS Directories
|
||||||
#New-Item -ItemType directory -Path C:\support -ErrorAction SilentlyContinue
|
New-Item -ItemType directory -Path C:\ProgramData\BTS -ErrorAction SilentlyContinue
|
||||||
#New-Item -ItemType directory -Path C:\support\software -ErrorAction SilentlyContinue
|
New-Item -ItemType directory -Path C:\ProgramData\BTS\software -ErrorAction SilentlyContinue
|
||||||
#New-Item -ItemType directory -Path C:\support\software\AnyDesk -ErrorAction SilentlyContinue
|
New-Item -ItemType directory -Path C:\ProgramData\BTS\software\AnyDesk -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
#Install BizTech Synergy RMM Agent
|
#Install BizTech Synergy RMM Agent
|
||||||
write-host 'Installing BizTech Synergy RMM agent..' -ForegroundColor Yellow
|
# author: https://github.com/bradhawkins85
|
||||||
if($apps.DisplayName -ne 'RMM Agent'){
|
$innosetup = 'tacticalagent-v2.8.0-windows-amd64.exe'
|
||||||
Invoke-RestMethod 'https://biztechsynergy.com.au/software/trmm-biztechsynergy-onboarding-workstation-amd64.exe' -Method 'GET' -OutFile "c:\support\software\trmm-biztechsynergy-onboarding-workstation-amd64.exe"
|
$api = '"https://api.biztechsynergy.xyz"'
|
||||||
start-process -WorkingDirectory 'C:\support\software' -FilePath '.\trmm-biztechsynergy-onboarding-workstation-amd64.exe'
|
$clientid = '3'
|
||||||
Start-sleep 60
|
$siteid = '5'
|
||||||
$syncro = get-process | where-object { $_.ProcessName -eq "trmm-biztechsynergy-agent" }
|
$agenttype = '"workstation"'
|
||||||
if ($null -ne $syncro) {
|
$power = 0
|
||||||
taskkill /pid $($Syncro.id) /f
|
$rdp = 1
|
||||||
|
$ping = 1
|
||||||
|
$auth = '"e8653cfe1d9750985926f13fdd79aca7bb79327c1fc5cca9fa06a533f762c7be"'
|
||||||
|
$downloadlink = 'https://github.com/amidaware/rmmagent/releases/download/v2.8.0/tacticalagent-v2.8.0-windows-amd64.exe'
|
||||||
|
$apilink = $downloadlink.split('/')
|
||||||
|
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
$serviceName = 'tacticalrmm'
|
||||||
|
If (Get-Service $serviceName -ErrorAction SilentlyContinue) {
|
||||||
|
write-host ('Tactical RMM Is Already Installed')
|
||||||
|
} Else {
|
||||||
|
$OutPath = $env:TMP
|
||||||
|
$output = $innosetup
|
||||||
|
|
||||||
|
$installArgs = @('-m install --api ', "$api", '--client-id', $clientid, '--site-id', $siteid, '--agent-type', "$agenttype", '--auth', "$auth")
|
||||||
|
|
||||||
|
if ($power) {
|
||||||
|
$installArgs += "--power"
|
||||||
}
|
}
|
||||||
$syncro = get-process | where-object { $_.ProcessName -eq "RMM.Installer" }
|
|
||||||
if ($null -ne $syncro) {
|
if ($rdp) {
|
||||||
taskkill /pid $($Syncro.id) /f
|
$installArgs += "--rdp"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ping) {
|
||||||
|
$installArgs += "--ping"
|
||||||
|
}
|
||||||
|
|
||||||
|
Try
|
||||||
|
{
|
||||||
|
$DefenderStatus = Get-MpComputerStatus | select AntivirusEnabled
|
||||||
|
if ($DefenderStatus -match "True") {
|
||||||
|
Add-MpPreference -ExclusionPath 'C:\ProgramData\TacticalAgent\*'
|
||||||
|
Add-MpPreference -ExclusionPath 'C:\ProgramData\Mesh Agent\*'
|
||||||
|
Add-MpPreference -ExclusionPath 'C:\ProgramData\TacticalRMM\*'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Catch {
|
||||||
|
# pass
|
||||||
|
}
|
||||||
|
|
||||||
|
$X = 0
|
||||||
|
do {
|
||||||
|
Write-Output "Waiting for network"
|
||||||
|
Start-Sleep -s 5
|
||||||
|
$X += 1
|
||||||
|
} until(($connectresult = Test-NetConnection $apilink[2] -Port 443 | ? { $_.TcpTestSucceeded }) -or $X -eq 3)
|
||||||
|
|
||||||
|
if ($connectresult.TcpTestSucceeded -eq $true){
|
||||||
|
Try
|
||||||
|
{
|
||||||
|
Invoke-WebRequest -Uri $downloadlink -OutFile $OutPath\$output
|
||||||
|
Start-Process -FilePath $OutPath\$output -ArgumentList ('/VERYSILENT /SUPPRESSMSGBOXES') -Wait
|
||||||
|
write-host ('Extracting...')
|
||||||
|
Start-Sleep -s 5
|
||||||
|
Start-Process -FilePath "C:\ProgramData\TacticalAgent\tacticalrmm.exe" -ArgumentList $installArgs -Wait
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
Catch
|
||||||
|
{
|
||||||
|
$ErrorMessage = $_.Exception.Message
|
||||||
|
$FailedItem = $_.Exception.ItemName
|
||||||
|
Write-Error -Message "$ErrorMessage $FailedItem"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
Finally
|
||||||
|
{
|
||||||
|
Remove-Item -Path $OutPath\$output
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "Unable to connect to server"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +261,7 @@ Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3"
|
||||||
##################
|
##################
|
||||||
$Chrome = $apps | where-object {$_.displayname -like "*chrome*"}
|
$Chrome = $apps | where-object {$_.displayname -like "*chrome*"}
|
||||||
if($null -eq $Chrome){
|
if($null -eq $Chrome){
|
||||||
$Path = 'C:\support\Software'
|
$Path = 'C:\ProgramData\BTS\software'
|
||||||
$Installer = "chrome_installer.exe"
|
$Installer = "chrome_installer.exe"
|
||||||
Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Path\$Installer
|
Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Path\$Installer
|
||||||
Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait
|
Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait
|
||||||
|
@ -206,22 +273,22 @@ Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -W
|
||||||
$vlc = $apps | where-object {$_.displayname -like "*VLC*"}
|
$vlc = $apps | where-object {$_.displayname -like "*VLC*"}
|
||||||
if($null -eq $vlc){
|
if($null -eq $vlc){
|
||||||
write-host 'Installing VLC' -ForegroundColor yellow
|
write-host 'Installing VLC' -ForegroundColor yellow
|
||||||
Invoke-RestMethod 'https://mirror.aarnet.edu.au/pub/videolan/vlc/3.0.21/win64/vlc-3.0.21-win64.exe' -Method 'GET' -OutFile "c:\support\software\vlc-3.0.21-win64.exe"
|
Invoke-RestMethod 'https://mirror.aarnet.edu.au/pub/videolan/vlc/3.0.21/win64/vlc-3.0.21-win64.exe' -Method 'GET' -OutFile "c:\ProgramData\BTS\software\vlc-3.0.21-win64.exe"
|
||||||
start-process -WorkingDirectory "C:\Support\Software" -FilePath '.\vlc-3.0.21-win64.exe' -argumentlist '/L=1033 /S'
|
start-process -WorkingDirectory "C:\ProgramData\BTS\Software" -FilePath '.\vlc-3.0.21-win64.exe' -argumentlist '/L=1033 /S'
|
||||||
}
|
}
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Install 7-zip
|
# Install 7-zip
|
||||||
##################
|
##################
|
||||||
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2301-x64.exe" -OutFile 'C:\support\7z2301-x64.exe'
|
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2301-x64.exe" -OutFile 'C:\ProgramData\BTS\7z2301-x64.exe'
|
||||||
Start-Process -WorkingDirectory 'C:\support' -FilePath '.\7z2301-x64.exe' -ArgumentList '/S'
|
Start-Process -WorkingDirectory 'C:\ProgramData\BTS' -FilePath '.\7z2301-x64.exe' -ArgumentList '/S'
|
||||||
|
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
# New Teams
|
# New Teams
|
||||||
####################################################
|
####################################################
|
||||||
Invoke-WebRequest -uri "https://biztechsynergy.com.au/software/teamsbootstrapper.exe" -outfile "C:\Support\software\teamsbootstrapper.exe"
|
Invoke-WebRequest -uri "https://biztechsynergy.com.au/software/teamsbootstrapper.exe" -outfile "C:\ProgramData\BTS\software\teamsbootstrapper.exe"
|
||||||
start-process -workingdirectory "C:\support\software" -filepath ".\teamsbootstrapper.exe" -ArgumentList "-p"
|
start-process -workingdirectory "C:\ProgramData\BTS\software" -filepath ".\teamsbootstrapper.exe" -ArgumentList "-p"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue