Last active
May 22, 2018 15:54
-
-
Save dev-kperera/696742db5d53834f61e235da34de4a31 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 to remove user custom signatures. It will automate removal of signatures in Windows machines. Tested in Windows 2012, 2016, 7, 8, and 10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove signures from users when you dont have centralized server | |
$MSLocation = $env:USERPROFILE.ToString() + "\AppData\Roaming\Microsoft\" | |
$SignaturesLocation = $MSLocation + "Signatures" | |
Try { | |
"User profile location - " + $SignaturesLocation | |
cd $SignaturesLocation | |
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() | |
Write-Host -ForegroundColor Red "Description of errror : " | |
$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