From e880e61b26b4f8b8a9ab05c1a06b4ba52c4cb396 Mon Sep 17 00:00:00 2001 From: Matthew White Date: Tue, 16 Aug 2022 14:43:36 -0400 Subject: [PATCH 1/2] Add BlankProfile switch to Launch-Chrome-Plex.ps1 Setting the non-default switch BlankProfile will prevent the script from using the Default profile associated with Chrome, causing the app to start almost immediately. Fixes #4 --- browsers/Launch-Chrome-Plex.ps1 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/browsers/Launch-Chrome-Plex.ps1 b/browsers/Launch-Chrome-Plex.ps1 index 22cf015..ddc7173 100644 --- a/browsers/Launch-Chrome-Plex.ps1 +++ b/browsers/Launch-Chrome-Plex.ps1 @@ -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\"; @@ -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"; From 0d5a559b219a3a34eaf30dcc5e26ce91e850c449 Mon Sep 17 00:00:00 2001 From: Matthew White Date: Tue, 16 Aug 2022 14:51:24 -0400 Subject: [PATCH 2/2] Added BlankProfile flag to the readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9a6a16d..4b9feed 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,4 @@ 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. \ No newline at end of file