2
0

Cleaned up Taskbar Layouts and Removing Public Shortcuts

This commit is contained in:
bschaper 2024-12-12 15:25:07 -06:00
parent c0816981a8
commit 2a901a2dc5
4 changed files with 47 additions and 33 deletions

View File

@ -0,0 +1,22 @@
# Remove All Shortcuts from Public Desktop Folder
# Set the path to the Public Desktop folder
$publicDesktop = "$env:Public\Desktop"
# Counter for deleted shortcuts
$deletedCount = 0
# Check if the Public Desktop folder exists
if (!(Test-Path $publicDesktop)) {
Write-Warning "Error: Public Desktop folder not found."
exit 1
}
# Remove all .lnk files from the Public Desktop
Get-ChildItem $publicDesktop -Filter "*.lnk" | ForEach-Object {
Remove-Item $_.FullName -Force
$deletedCount++
}
# Display results
Write-Host "Deleted $deletedCount shortcut(s) from the Public Desktop."

View File

@ -0,0 +1,16 @@
# Define the directory containing the .reg files
$regFilesDir = "C:\Scripts\StartLayouts"
# Get an array of all .reg files in the directory
$regFiles = Get-ChildItem -Path $regFilesDir -Filter "*.reg"
# Loop through each .reg file and import it
foreach ($regFile in $regFiles) {
reg import $regFile.FullName
}
# Restart File Explorer
Taskkill /F /IM explorer.exe
Start-Process explorer.exe
Write-Host "Taskbar layout successfully imported..."

View File

@ -47,39 +47,15 @@ winget install --exact --id Zoom.Zoom --silent
echo Installing Adobe Reader... echo Installing Adobe Reader...
winget install --exact --id Adobe.Acrobat.Reader.64-bit --silent winget install --exact --id Adobe.Acrobat.Reader.64-bit --silent
::: Define Taskbar Layout Path :: Set Taskbar Layout for All Users
set "REG_FILES_DIR=C:\Scripts\StartLayouts" echo Setting Taskbar Layout...
powershell -ExecutionPolicy Bypass -File "C:\Scripts\StartLayouts\Set-Taskbar-Layout.ps1"
echo Taskbar Layout is Set...
::: Loop through each .reg file in the directory :: Delete Shortcuts from Public Desktop Folder
for %%f in (%REG_FILES_DIR%\*.reg) do ( echo Deleting Shortcuts from Public Desktop Folder...
reg import "%%f" powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Delete-Public-Shortcuts.ps1"
) echo Shortcuts Have Been Deleted...
echo Taskbar layout successfully imported...
:: Remove All Shortcuts from Public Desktop Folder
:: Set the path to the Public Desktop folder
set "PUBLIC_DESKTOP=%PUBLIC%\Desktop"
:: Counter for deleted shortcuts
set "deleted_count=0"
:: Check if the Public Desktop folder exists
if not exist "%PUBLIC_DESKTOP%" (
echo Error: Public Desktop folder not found.
exit /b 1
)
:: Remove all .lnk files from the Public Desktop
for %%F in ("%PUBLIC_DESKTOP%\*.lnk") do (
del "%%F"
if !errorlevel! equ 0 (
set /a "deleted_count+=1"
)
)
:: Display results
echo Deleted !deleted_count! shortcut(s) from the Public Desktop.
:: GCPW Add Allowed Domain to Registry :: GCPW Add Allowed Domain to Registry
echo Adding Domain to GCPW Registry... echo Adding Domain to GCPW Registry...
@ -97,7 +73,7 @@ powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windo
echo Successfully Copied Login Scripts... echo Successfully Copied Login Scripts...
:: Perform Windows Updates :: Perform Windows Updates
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Initial-Windows-Updates.ps1" powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Initial-Windows-Updates.ps1"
:: Restart System :: Restart System
echo Restarting system in 2.5 minutes... echo Restarting system in 2.5 minutes...