diff --git a/docs/secure-connections/sauce-connect-5/installation/windows.md b/docs/secure-connections/sauce-connect-5/installation/windows.md index e2245427e1..0d8684969a 100644 --- a/docs/secure-connections/sauce-connect-5/installation/windows.md +++ b/docs/secure-connections/sauce-connect-5/installation/windows.md @@ -8,62 +8,83 @@ import useBaseUrl from '@docusaurus/useBaseUrl'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -### Unpack the zip file +## With winget - - +On Windows 10 and newer you can install Sauce Connect with the builtin [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/) package manager. +This is the recommended way to install Sauce Connect on Windows. -```bash -mkdir C:\sauce-connect -Invoke-WebRequest -Uri https://saucelabs.com/downloads/sauce-connect/5.2.0/sauce-connect-5.2.0_windows.aarch64.zip -OutFile sauce-connect.zip -Expand-Archive -Path sauce-connect.zip -DestinationPath C:\sauce-connect +### Install + +Open Terminal and run the following command to install Sauce Connect: + +```powershell +winget install SauceLabs.SauceConnect ``` - - +### Set sc alias -```bash -mkdir C:\sauce-connect -Invoke-WebRequest -Uri https://saucelabs.com/downloads/sauce-connect/5.2.0/sauce-connect-5.2.0_windows.x86_64.zip -OutFile sauce-connect.zip -Expand-Archive -Path sauce-connect.zip -DestinationPath C:\sauce-connect +Sauce Connect for Windows installs the `sauce-connect` command not `sc`. +This is due to the fact that the `sc` command is already used by the system. +To work around this issue, you can set an alias for the `sauce-connect` command. + +In Terminal run the following command to permanently set the `sc` alias for `sauce-connect`: + +```powershell +if (-Not (Test-Path -Path $PROFILE)) { + New-Item -ItemType File -Path $PROFILE -Force +} +Add-Content -Path $PROFILE -Value "Set-Alias -Name 'sc' -Value 'sauce-connect' -Option 'AllScope' -Force" ``` - - +Open a new Terminal window to use the `sc` command for Sauce Connect. -### Add the binary to PATH +### Add command completion -Add `C:\sauce-connect` to `PATH` environment variable. +In Terminal run the following script to add `sc` command completion to PowerShell: -```bash -$currentPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -$newPath = "$currentPath;C:\sauce-connect" -[System.Environment]::SetEnvironmentVariable('PATH', $newPath, [System.EnvironmentVariableTarget]::Machine) +```powershell +if (-Not (Test-Path -Path $PROFILE)) { + New-Item -ItemType File -Path $PROFILE -Force +} +Add-Content -Path $PROFILE -Value "Invoke-Expression (sauce-connect completion powershell | Out-String)" ``` -### Add completion +Open a new Terminal window to use the `sc` command with completion. + +### Edit config file + +This step is optional. You can use default configuration or configure Sauce Connect with flags or environment variables. +See [CLI reference](/dev/cli/sauce-connect-5/) for more details. -Open PowerShell and check if you already have a profile. +Get the default configuration file: -```bash -Test-Path $PROFILE +```powershell +sc run config-file > sauce-connect.yaml ``` -If the command returns `False`, create a new profile. +Edit the configuration file with your favorite editor: -```bash -New-Item -ItemType File -Path $PROFILE -Force +```powershell +notepad sauce-connect.yaml ``` -Add PowerShell completion to the profile. +### Start Sauce Connect + +```powershell +sc run --config-file sauce-connect.yaml +``` + +## With zip package + +Sauce Connect provides `.zip` package that can be used on older Windows versions that do not support winget. + +### Unpack the zip file -```bash -Add-Content -Path $PROFILE -Value ". C:\sauce-connect\completions\sc.ps1" +```powershell +mkdir C:\sauce-connect +Invoke-WebRequest -Uri https://saucelabs.com/downloads/sauce-connect/5.2.0/sauce-connect-5.2.0_windows.x86_64.zip -OutFile sauce-connect.zip +Expand-Archive -Path sauce-connect.zip -DestinationPath C:\sauce-connect +Rename-Item -Path C:\sauce-connect\sauce-connect.exe -NewName C:\sauce-connect\sc.exe ``` ### Edit config file @@ -71,12 +92,21 @@ Add-Content -Path $PROFILE -Value ". C:\sauce-connect\completions\sc.ps1" This step is optional. You can use default configuration or configure Sauce Connect with flags or environment variables. See [CLI reference](/dev/cli/sauce-connect-5/) for more details. -```bash -notepad C:\sauce-connect\sauce-connect.yaml +Get the default configuration file: + +```powershell +cd C:\sauce-connect +./sc.exe run config-file > sauce-connect.yaml +``` + +Edit the configuration file with your favorite editor: + +```powershell +notepad sauce-connect.yaml ``` ### Start Sauce Connect -```bash -sc.exe run --config-file C:\sauce-connect\sauce-connect.yaml +```powershell +./sc.exe run --config-file sauce-connect.yaml ```