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,25 +30,92 @@ function unzip {
|
|||
[System.IO.Compression.ZipFile]::ExtractToDirectory( $ziparchive, $extractpath )
|
||||
}
|
||||
|
||||
#Create Support Directories
|
||||
#New-Item -ItemType directory -Path C:\support -ErrorAction SilentlyContinue
|
||||
#New-Item -ItemType directory -Path C:\support\software -ErrorAction SilentlyContinue
|
||||
#New-Item -ItemType directory -Path C:\support\software\AnyDesk -ErrorAction SilentlyContinue
|
||||
#Create ProgramData\BTS Directories
|
||||
New-Item -ItemType directory -Path C:\ProgramData\BTS -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType directory -Path C:\ProgramData\BTS\software -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType directory -Path C:\ProgramData\BTS\software\AnyDesk -ErrorAction SilentlyContinue
|
||||
|
||||
#Install BizTech Synergy RMM Agent
|
||||
write-host 'Installing BizTech Synergy RMM agent..' -ForegroundColor Yellow
|
||||
if($apps.DisplayName -ne 'RMM Agent'){
|
||||
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"
|
||||
start-process -WorkingDirectory 'C:\support\software' -FilePath '.\trmm-biztechsynergy-onboarding-workstation-amd64.exe'
|
||||
Start-sleep 60
|
||||
$syncro = get-process | where-object { $_.ProcessName -eq "trmm-biztechsynergy-agent" }
|
||||
if ($null -ne $syncro) {
|
||||
taskkill /pid $($Syncro.id) /f
|
||||
}
|
||||
$syncro = get-process | where-object { $_.ProcessName -eq "RMM.Installer" }
|
||||
if ($null -ne $syncro) {
|
||||
taskkill /pid $($Syncro.id) /f
|
||||
}
|
||||
# author: https://github.com/bradhawkins85
|
||||
$innosetup = 'tacticalagent-v2.8.0-windows-amd64.exe'
|
||||
$api = '"https://api.biztechsynergy.xyz"'
|
||||
$clientid = '3'
|
||||
$siteid = '5'
|
||||
$agenttype = '"workstation"'
|
||||
$power = 0
|
||||
$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"
|
||||
}
|
||||
|
||||
if ($rdp) {
|
||||
$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"
|
||||
}
|
||||
}
|
||||
|
||||
#Start WinRM Service
|
||||
|
@ -194,7 +261,7 @@ Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3"
|
|||
##################
|
||||
$Chrome = $apps | where-object {$_.displayname -like "*chrome*"}
|
||||
if($null -eq $Chrome){
|
||||
$Path = 'C:\support\Software'
|
||||
$Path = 'C:\ProgramData\BTS\software'
|
||||
$Installer = "chrome_installer.exe"
|
||||
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
|
||||
|
@ -206,22 +273,22 @@ Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -W
|
|||
$vlc = $apps | where-object {$_.displayname -like "*VLC*"}
|
||||
if($null -eq $vlc){
|
||||
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"
|
||||
start-process -WorkingDirectory "C:\Support\Software" -FilePath '.\vlc-3.0.21-win64.exe' -argumentlist '/L=1033 /S'
|
||||
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:\ProgramData\BTS\Software" -FilePath '.\vlc-3.0.21-win64.exe' -argumentlist '/L=1033 /S'
|
||||
}
|
||||
|
||||
##################
|
||||
# Install 7-zip
|
||||
##################
|
||||
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2301-x64.exe" -OutFile 'C:\support\7z2301-x64.exe'
|
||||
Start-Process -WorkingDirectory 'C:\support' -FilePath '.\7z2301-x64.exe' -ArgumentList '/S'
|
||||
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2301-x64.exe" -OutFile 'C:\ProgramData\BTS\7z2301-x64.exe'
|
||||
Start-Process -WorkingDirectory 'C:\ProgramData\BTS' -FilePath '.\7z2301-x64.exe' -ArgumentList '/S'
|
||||
|
||||
|
||||
####################################################
|
||||
# New Teams
|
||||
####################################################
|
||||
Invoke-WebRequest -uri "https://biztechsynergy.com.au/software/teamsbootstrapper.exe" -outfile "C:\Support\software\teamsbootstrapper.exe"
|
||||
start-process -workingdirectory "C:\support\software" -filepath ".\teamsbootstrapper.exe" -ArgumentList "-p"
|
||||
Invoke-WebRequest -uri "https://biztechsynergy.com.au/software/teamsbootstrapper.exe" -outfile "C:\ProgramData\BTS\software\teamsbootstrapper.exe"
|
||||
start-process -workingdirectory "C:\ProgramData\BTS\software" -filepath ".\teamsbootstrapper.exe" -ArgumentList "-p"
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue