Public/New-WebLogin.ps1
<#
.SYNOPSIS This function uses chromedriver.exe via Selenium to log you into web service specified by the -ServiceName parameter. .DESCRIPTION See .SYNOPSIS .NOTES .PARAMETER ServiceName This parameter is MANDATORY. This parameter takes a string that represents the name of the service that you would like to log into via Google Chrome (chromedriver.exe). Currently, supported services are: AmazonMusic, Audible, GooglePlay, InternetArchive, NPR, Pandora, ReelGood, Spotify, Tidal, TuneIn, YouTube, and YouTubeMusic .PARAMETER ChromeProfileNumber This parameter is OPTIONAL. This parameter is takes an int that represents the Chrome Profile that you would like to use when launching Google Chrome via chromedriver.exe. Use the following PowerShell one-liner to list all available Chrome Profiles under the current Windows user: (Get-ChildItem -Path "$HOME\AppData\Local\Google\Chrome\User Data" -Directory -Filter "Profile *").Name .EXAMPLE # Open an PowerShell session, import the module, and - PS C:\Users\zeroadmin> New-WebLogin -ServiceName AmazonMusic -ChromeProfileNumber 1 #> function New-WebLogin { [CmdletBinding()] param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [ValidateSet("AmazonMusic","Audible","GooglePlay","InternetArchive","NPR","Pandora","ReelGood","Spotify","Tidal","TuneIn","YouTube","YouTubeMusic")] [string]$ServiceName, [parameter(Mandatory=$false)] [int]$ChromeProfileNumber ) $PSCmdString = $ServiceName + 'SeleniumLoginCheck' if ($ChromeProfileNumber) { $PSCmdString = $PSCmdString + ' ' + '-ChromeProfileNumber' + ' ' + $ChromeProfileNumber } Invoke-Expression -Command $PSCmdString } |