Skip to content

Instantly share code, notes, and snippets.

@dev-kperera
Last active December 19, 2019 19:59
Show Gist options
  • Save dev-kperera/975842bb2d76889c1f8aea97d021699b to your computer and use it in GitHub Desktop.
Save dev-kperera/975842bb2d76889c1f8aea97d021699b to your computer and use it in GitHub Desktop.
While in the progress of deploying signatures with centralized location in Office 365, I found this piece of code to be used.
# Remove signures from users when you dont have centralized server
$MSLocation = $env:USERPROFILE.ToString() + "\AppData\Roaming\Microsoft\"
$SignaturesLocation = $MSLocation + "Signatures"
$BackupFolder = $MSLocation + "Signatures Backup"
Try {
"User profile location" + $SignaturesLocation
cd $SignaturesLocation
#New-Item -ItemType directory -Path $BackupFolder
#Get-ChildItem -Path $SignaturesLocation + "\*.*" -Recurse | Move-Item -Destination @BackupFolder
Get-ChildItem *.txt | Rename-Item -NewName { $_.name -Replace '\.txt$','.txt.bkp' }
Get-ChildItem *.htm | Rename-Item -NewName { $_.name -Replace '\.htm$','.htm.bkp' }
Get-ChildItem *.rtf | Rename-Item -NewName { $_.name -Replace '\.rtf$','.rtf.bkp' }
}
Catch [System.Exception] {
Write-Host -ForegroundColor Red "Signature removal failed"
Write-Host -ForegroundColor Green "This script only supports Windows Vista,Windows 7, Windows 8, Windows 8.1, or Windows 10"
Write-Host -ForegroundColor Red "Your version of Windows is" ([System.Environment]::OSVersion.Version).ToString()
$error[0].ToString() + $error[0].InvocationInfo.PositionMessage
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment