Revert commit 79df17763a
This commit is contained in:
@@ -27,9 +27,7 @@ $uid = $Env:UserName
|
||||
# Get the directory where this script is located
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
# Copy-Item -Path "$scriptDir\FastStone" -Destination "C:\Users\$uid\AppData\Local\" -Recurse -Force
|
||||
|
||||
# === FIREFOX POLICIES AND USER.JS ===
|
||||
Copy-Item -Path "$scriptDir\FastStone" -Destination "C:\Users\$uid\AppData\Local\" -Recurse -Force
|
||||
|
||||
# Define the Firefox installation directory
|
||||
$firefoxPath = "C:\Program Files\Mozilla Firefox"
|
||||
@@ -49,7 +47,91 @@ Copy-Item -Path $sourceFile -Destination $destinationFile -Force
|
||||
|
||||
Write-Host "policies.json has been copied/replaced in the distribution folder."
|
||||
|
||||
# === ShareX Configs ===
|
||||
$forgePath = "C:\ProgramData\miniforge3"
|
||||
$forgeScriptsPath = "C:\ProgramData\miniforge3\Scripts"
|
||||
$systemPathReference = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
|
||||
# Check if the path already contains $forgePath
|
||||
if (-not ($systemPathReference -split ";" | Where-Object { $_ -eq $forgePath })) {
|
||||
# Append $forgePath to the existing path, with proper separation by semicolon
|
||||
$newPath = $systemPathReference + ";" + $forgePath
|
||||
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "Machine")
|
||||
}
|
||||
|
||||
# Check if the path already contains $forgeScriptsPath
|
||||
if (-not ($systemPathReference -split ";" | Where-Object { $_ -eq $forgeScriptsPath })) {
|
||||
# Get the updated path (in case it was modified above)
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
# Append $forgeScriptsPath to the existing path, with proper separation by semicolon
|
||||
$newPath = $currentPath + ";" + $forgeScriptsPath
|
||||
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "Machine")
|
||||
}
|
||||
|
||||
# Define the base Firefox profiles directory
|
||||
$profilesDir = "$env:APPDATA\Mozilla\Firefox\Profiles"
|
||||
|
||||
# Define the source user.js file
|
||||
$sourceFile = "$scriptDir\Firefox\user.js" # Use absolute path based on script location
|
||||
|
||||
# Check if the source file exists
|
||||
if (-not (Test-Path -Path $sourceFile)) {
|
||||
Write-Error "Source user.js file not found at $sourceFile"
|
||||
exit
|
||||
}
|
||||
|
||||
# Loop through all subdirectories in the profiles folder
|
||||
Get-ChildItem -Path $profilesDir -Directory | ForEach-Object {
|
||||
$profilePath = $_.FullName
|
||||
$destinationFile = Join-Path -Path $profilePath -ChildPath "user.js"
|
||||
|
||||
# Copy the user.js file to the profile directory
|
||||
Copy-Item -Path $sourceFile -Destination $destinationFile -Force
|
||||
Write-Host "user.js has been placed in: $profilePath"
|
||||
}
|
||||
|
||||
Write-Host "Operation completed for all Firefox profiles."
|
||||
|
||||
|
||||
|
||||
# Path to the CSV file
|
||||
$csvFilePath = "$scriptDir\registry.csv"
|
||||
$entries = Import-Csv -Path $csvFilePath
|
||||
|
||||
foreach ($entry in $entries) {
|
||||
# Trim fields to remove extra spaces
|
||||
$registryPath = $entry.registryPath.Trim()
|
||||
$propertyName = $entry.propertyName.Trim()
|
||||
$propertyType = $entry.propertyType.Trim()
|
||||
$propertyValue = $entry.propertyValue.Trim()
|
||||
|
||||
# Validate required fields
|
||||
if (-not $registryPath -or -not $propertyName -or -not $propertyType -or -not $propertyValue) {
|
||||
Write-Warning "Skipping row with incomplete data: $($entry | Out-String)"
|
||||
continue
|
||||
}
|
||||
|
||||
# Print debug info
|
||||
#Write-Host "Processing: Path=$registryPath Name=$propertyName Type=$propertyType Value=$propertyValue"
|
||||
|
||||
# Check if registry path exists, create if necessary
|
||||
if (-not (Test-Path $registryPath)) {
|
||||
try {
|
||||
New-Item -Path $registryPath -Force | Out-Null
|
||||
Write-Host "Created missing path: $registryPath"
|
||||
} catch {
|
||||
Write-Warning "Failed to create path: $registryPath. $_"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
# Set the registry property
|
||||
try {
|
||||
Set-ItemProperty -Path $registryPath -Name $propertyName -Type $propertyType -Value $propertyValue
|
||||
# Write-Host "Successfully set $propertyName in $registryPath to $propertyValue."
|
||||
} catch {
|
||||
Write-Warning "Failed to set $propertyName in $registryPath. $_"
|
||||
}
|
||||
}
|
||||
|
||||
# ShareX - Remove "Capture Entire Screen" shortcut
|
||||
Write-Host "Configuring ShareX shortcuts..."
|
||||
@@ -185,8 +267,6 @@ if ($shareXProcess -and (Test-Path -Path $shareXExePath)) {
|
||||
Write-Warning "Could not restart ShareX: Executable not found at $shareXExePath"
|
||||
}
|
||||
|
||||
# === XMouseButtonControl Configs ===
|
||||
|
||||
# XMouseButtonControl - Replace configuration files
|
||||
Write-Host "Configuring XMouseButtonControl..."
|
||||
|
||||
@@ -220,8 +300,6 @@ if (Test-Path -Path $sourceProfile) {
|
||||
Write-Warning "psymon's XMBC Settings.xmbcp not found in source directory"
|
||||
}
|
||||
|
||||
# === ENVIRONMENT VARIABLES AND PATH UPDATES ===
|
||||
|
||||
# Update Windows hosts file with entries to block license servers
|
||||
Write-Host "Updating Windows hosts file..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user