Advertisement
abeauchamp

Untitled

Jun 9th, 2025
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $path = "$env:temp\installs"
  2. if (!(test-path $path)) {
  3.   New-Item -Path $path -ItemType Directory
  4. }
  5.  
  6. Start-Transcript -Path "$path\screenconnect.log"
  7.  
  8. Write-host "Setting variables"
  9. $company = [uri]::EscapeDataString($env:NINJA_ORGANIZATION_NAME)
  10. $location = [uri]::EscapeDataString($env:NINJA_LOCATION_NAME)
  11. $url = "https://YOURSCREENCONNECTURL/Bin/ScreenConnect.ClientSetup.msi?e=Access&y=Guest&c=$($company)&c=$($location)&c=&c=&c=&c=&c=&c="
  12. $file = "$path\connect.msi"
  13.  
  14. Write-host "Downloading installer for $company $location from $url and saving at $file"
  15. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  16. try {
  17.   (New-Object System.Net.WebClient).DownloadFile($url, $file)
  18. } catch {
  19.   Write-Host $_.exception.Message
  20. }
  21.  
  22. write-host "Installing $file with msiexec"
  23. try {
  24.   msiexec /i $file /qn
  25. } catch {
  26.   Write-Host $_.exception.Message
  27. }
  28.  
  29. Stop-Transcript
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement