Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ To use, download the PowerShell script to the machine and create a shortcut to i
|`.\Launch-Chrome-Plex.ps1 -Product UX -CompanyCode edgeent` | Company-specific UX session for Edge Enterprises |
|`.\Launch-Chrome-Plex.ps1 -Product Classic` | Classic session |

In addition, you can set the flag `-BlankProfile` to avoid copying the Chrome Default profile. This will remove any favorites, plugins, and other customization from the new session, but does significantly cut down on launch time.

## Using the Scripts
PowerShell is a replacement for the Command Prompt in Windows. Windows PowerShell has been installed by default since Windows 7. Versions of Windows back to XP can install PowerShell manually. A cross-platform version of PowerShell, previously called PowerShell Core, also exists for Windows, MacOS, and Linux. All scripts are confirmed to work under both Windows PowerShell (`powershell.exe`) and the cross-platform PowerShell (`pwsh.exe`).

To invoke a PowerShell script, download it from this repository. Advanced users may use `git clone` to pull the entire repository, but you can also download individual files by nagivating to them, clicking the `Raw` button in the top right corner of the page, and downloading the content that appears.

Once the file exists on your machine, create a shortcut to it. For the shortcut path, enter `powershell.exe -ExecutionPolicy Bypass -File ""`, where the path to the script is in quotes. If you wish to pass in additional parameters, you can do so by appending them to the end of the shortcut path: `powershell.exe -ExecutionPolicy Bypass -File "" -Product Classic -CompanyCode edgeent`.

If upon launching your shortcut, nothing happens, try appending `-noexit` after `powershell.exe` to read the error message that appears.
If upon launching your shortcut, nothing happens, try appending `-noexit` after `powershell.exe` to read the error message that appears.
12 changes: 10 additions & 2 deletions browsers/Launch-Chrome-Plex.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ The product to open (`UX` or `Classic`); defaults to `UX`

.PARAMETER CompanyCode
The company code, used to generate customer-specific URLs for UX

.PARAMETER BlankProfile
If set, uses a blank profile rather than copying the Default profile
#>

[CmdletBinding()]
Param(
[ValidateSet("UX", "Classic")]
[string]$Product = "UX",
[string]$CompanyCode = ""
[string]$CompanyCode = "",
[switch]$BlankProfile = $false
)

$userData = Join-Path $env:LOCALAPPDATA "\Google\Chrome\User Data\";
Expand All @@ -31,7 +35,11 @@ $unixEpoch = (Get-Date 1970-01-01Z).ToUniversalTime();
$id = [System.Math]::Round([System.DateTime]::Now.ToUniversalTime().Subtract($unixEpoch).TotalSeconds);
$newDataDir = ($userData + "TempPlexProfile" + $id);

Copy-Item -Path ($userData + "Default\") -Destination $newDataDir -Recurse;
if ($BlankProfile) {
mkdir $newDataDir > $null;
} else {
Copy-Item -Path ($userData + "Default\") -Destination $newDataDir -Recurse;
}

if ($Product -eq "Classic") {
$url = "https://www.plexonline.com/signon";
Expand Down