# PowerShell script to download, extract, and guide installation of Chrome extension
# URL of the ZIP file
$zipUrl = "https://drive.google.com/uc?export=download&id=1qjvlZENoVppEFfyzzJSKZdhcur1zQnxZ"
# Temporary path for the downloaded ZIP
$zipPath = Join-Path -Path $env:TEMP -ChildPath "chrome_extension.zip"
# Array to collect messages
$messages = @()
# Download the ZIP file
try {
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath -ErrorAction Stop
$messages += "File downloaded successfully."
} catch {
$messages += "Error downloading file: $_"
# Create HTML with error and open
$htmlContent = @"
Extension Installation Log
Installation Log
$(($messages | ForEach-Object { "- $_
" }) -join "`n")
"@
$htmlPath = Join-Path -Path $env:TEMP -ChildPath "installation_log.html"
$htmlContent | Out-File -FilePath $htmlPath -Encoding utf8
Start-Process $htmlPath
exit
}
# Load assembly for GUI dialog
Add-Type -AssemblyName System.Windows.Forms
# Show folder browser dialog for user to choose parent folder
$folderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
$folderBrowser.Description = "Choose a parent folder where the Chrome extension folder will be extracted."
$folderBrowser.RootFolder = "MyComputer"
if ($folderBrowser.ShowDialog() -eq "OK") {
$extractPath = $folderBrowser.SelectedPath
} else {
$messages += "Extraction canceled."
Remove-Item $zipPath -ErrorAction SilentlyContinue
# Create HTML and open
$htmlContent = @"
Extension Installation Log
Installation Log
$(($messages | ForEach-Object { "- $_
" }) -join "`n")
"@
$htmlPath = Join-Path -Path $env:TEMP -ChildPath "installation_log.html"
$htmlContent | Out-File -FilePath $htmlPath -Encoding utf8
Start-Process $htmlPath
exit
}
# Extract the ZIP to the selected folder
try {
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force -ErrorAction Stop
$messages += "Extension extracted successfully to: $extractPath"
} catch {
$messages += "Error extracting: $_"
Remove-Item $zipPath -ErrorAction SilentlyContinue
# Create HTML with error and open
$htmlContent = @"
Extension Installation Log
Installation Log
$(($messages | ForEach-Object { "- $_
" }) -join "`n")
"@
$htmlPath = Join-Path -Path $env:TEMP -ChildPath "installation_log.html"
$htmlContent | Out-File -FilePath $htmlPath -Encoding utf8
Start-Process $htmlPath
exit
}
# Delete the ZIP file
Remove-Item $zipPath -ErrorAction SilentlyContinue
$messages += "ZIP file deleted."
# Define the extension folder name
$extensionFolder = Join-Path -Path $extractPath -ChildPath "Levnet EasyLogin"
# Create HTML file with log and bilingual instructions using the provided template
$htmlContent = @"
Chrome Extension Installation Guide
Extension Installation Guide – מדריך התקנת תוסף
Installation Log
$(($messages | ForEach-Object { "- $_
" }) -join "`n")
English
Step 1 – Open Extensions Page
Open a new Chrome tab and type:
chrome://extensions/
Or via the menu: 3 vertical dots > Extensions > Manage Extensions.
Step 2 – Enable Developer Mode
The switch is on the top right corner.
Its name: Developer mode.
Step 3 – Load the Extension
Click the button on the top left corner called Load unpacked.
Choose the folder:
$extensionFolder
Step 4 – Confirm Installation
The extension will appear in your list of installed extensions.
עברית
שלב 1 – פתיחת דף התוספים
פתח כרטיסייה חדשה והזן:
chrome://extensions/
או דרך התפריט: 3 נקודות אנכיות > תוספים > ניהול תוספים.
שלב 2 – הפעלת מצב מפתח
המתג נמצא בצד שמאל למעלה.
שמו: מצב פיתוח.
שלב 3 – טעינת התוסף
לחץ על הכפתור בצד ימין למעלה בשם טעינת פריט לא ארוז (Unpacked).
בחר את התיקייה:
$extensionFolder
שלב 4 – אישור התקנה
התוסף יופיע ברשימת התוספים המותקנים בכרום.
"@
# Save HTML to temp file
$htmlPath = Join-Path -Path $env:TEMP -ChildPath "installation_log.html"
$htmlContent | Out-File -FilePath $htmlPath -Encoding utf8
# Open the HTML file in default browser
Start-Process $htmlPath