Skip to content

Commit

Permalink
Update setup.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
xmt3061123 authored Jun 21, 2024
1 parent e8155dd commit 0ee6c1e
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions setup.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# setup.ps1

# Function to log and exit on error
function Log-Error {
param (
[string]$Message
)
Write-Error $Message
exit 1
}

# Disable Firewall Profiles
try {
Write-Output "Disabling Firewall Profiles for Domain, Public, and Private..."
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
Write-Output "Firewall Profiles disabled successfully."
} catch {
Write-Error "Failed to disable Firewall Profiles: $_"
exit 1
Log-Error "Failed to disable Firewall Profiles: $_"
}

# Download and Install Chrome Remote Desktop Host
Expand All @@ -18,9 +28,17 @@ try {
Write-Output "Cleaning up installer..."
Remove-Item -Path $remoteDesktopInstaller
Write-Output "Chrome Remote Desktop Host installed successfully."

# Confirm the installation path and save it to an environment variable
$crdPath = "${Env:ProgramFiles(x86)}\Google\Chrome Remote Desktop\CurrentVersion\remoting_start_host.exe"
if (Test-Path $crdPath) {
Write-Output "Chrome Remote Desktop Host found at $crdPath."
[System.Environment]::SetEnvironmentVariable('CRD_PATH', $crdPath, [System.EnvironmentVariableTarget]::Machine)
} else {
Log-Error "Chrome Remote Desktop Host not found at expected path: $crdPath"
}
} catch {
Write-Error "Failed to install Chrome Remote Desktop Host: $_"
exit 1
Log-Error "Failed to install Chrome Remote Desktop Host: $_"
}

# Download and Install Google Chrome
Expand All @@ -34,6 +52,5 @@ try {
Remove-Item -Path $chromeInstaller
Write-Output "Google Chrome installed successfully."
} catch {
Write-Error "Failed to install Google Chrome: $_"
exit 1
Log-Error "Failed to install Google Chrome: $_"
}

0 comments on commit 0ee6c1e

Please sign in to comment.