Skip to content

Instantly share code, notes, and snippets.

@janmechtel
Last active September 7, 2020 07:05
Show Gist options
  • Save janmechtel/6a33a1f628c2450dc49a5d9821daaff4 to your computer and use it in GitHub Desktop.
Save janmechtel/6a33a1f628c2450dc49a5d9821daaff4 to your computer and use it in GitHub Desktop.
# This script helps you to make your PC demo ready by:
# - Cleaning out the desktop
# - Hiding recent items in PowerPoint
# TODO: Make it a toggle script ...
# ... stored state somewhere
# ... make it a parameter
# ... have two scripts for enable/disable
# TODO: Turn Focus Assist on
# https://appuals.com/how-to-change-windows-10-quiet-hours-focus-assist-automatic-rules/
# Unfortunately this is not working :-(
# Clean desktop by moving all files to and Desktop-Archive folder
$destination = "$env:USERPROFILE\Desktop-Archive"
Get-ChildItem $env:USERPROFILE\Desktop |
ForEach-Object {
# Rename If File Exists
# https://stackoverflow.com/questions/16839787/powershell-move-item-rename-if-file-exists
$nextName = Join-Path -Path $destination -ChildPath $_.name
$num=0
while(Test-Path -Path $nextName)
{
$nextName = Join-Path $destination ($_.BaseName + "_$num" + $_.Extension)
$num+=1
}
try {
Move-Item -Path $_.FullName -Destination $nextName -ErrorAction Continue
}
catch {
"Skipping file because it's locked / open"
$_.FullName
}
}
# Create a shortcut to the Desktop Archive
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Archive.lnk")
$Shortcut.TargetPath = $destination
$Shortcut.Save()
#- Hide Recent Files in PowerPoint by setting Max Display to 0
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\PowerPoint\File MRU" -Name "Max Display" -Value 0
# TODO: Repeat for Word & Excel
#- Disable red underlines in PowerPoint, Word etc.
#- How to Hide emails in Outlook? >> maybe recommend 2 Screen Setup
#- Consider changing Default Brower and clearing History
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment