Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove ads in skype
# start as admin!
# prompt for username
$SkypeUserName = Read-Host -Prompt "What is your Skype username?"
# stop skype-process
if(Get-Process | ? {$_.Name -like 'skype'}) {Stop-Process -Name skype}
# commit changes to hosts file
$hostfile = "C:\Windows\System32\Drivers\etc\hosts"
if ((gc $hostfile) -notcontains ""){
Write-Host -ForegroundColor Green "Adding content to hosts file"
Add-Content $hostfile `
`r`n127.0.0.1" `
} else {
Write-Host -ForegroundColor Red "Your hosts-file most likely contains the correct values for redirecting URI for Ads to Localhost."
# set var for xml path
$xmlpath = "C:\users\$env:USERNAME\Appdata\Roaming\skype\$SkypeUserName\config.xml"
# check if xml is read only, set to false if value is true
if (Get-ItemProperty -Path $xmlpath | ? {$_.IsReadOnly -eq $true}) {
Set-ItemProperty -Path $xmlpath -Name IsReadOnly -Value $false}
# commit changes to xml file
Write-Host -ForegroundColor Green "Setting AdvertPlaceholder and AdvertEastRailsEnabled to 0"
$xml = [xml] (Get-Content $xmlpath)
$xml.config.UI.General.AdvertPlaceholder = '0'
$xml.config.UI.General.AdvertEastRailsEnabled = '0'
# set xml to read only
Set-ItemProperty -Path $xmlpath -Name IsReadOnly -Value $true
catch {
write-host -ForegroundColor Red "There was some kind of error in here, I would suggest that you make sure you run this script as administrator or change your hosts file and config.xml manually."
finally {
$answer = Read-Host "Start Skype and tell me if your ad ribbon is removed! Yes/No (Do NOT close this window before you've tried.)"
if ($answer -eq 'N' -or $answer -eq 'No'){
# set var
$xmlbackup = "C:\users\$env:USERNAME\appdata\roaming\skype\$SkypeUserName\config.xml_old"
$skypedir = "C:\users\$env:USERNAME\appdata\roaming\skype\$SkypeUserName"
#kill process if exist
Write-Host -ForegroundColor Green "Killing skype.exe"
if(Get-Process | ? {$_.Name -like 'skype'}) {
Stop-Process -Name skype}
# backing up config xml
Write-Host -ForegroundColor Green "Backing up your config.xml file"
Copy-Item -Path $xmlpath -Destination $xmlbackup -Force
# removing read only
if (Get-ItemProperty -Path $xmlpath | ? {$_.IsReadOnly -eq $true}) {
Set-ItemProperty -Path $xmlpath -Name IsReadOnly -Value $false}
# fetch the backup file and remove the content - then save as new config.xml
Write-Host -ForegroundColor Green "Fetching the backup file, removing some content, then saving as a new config.xml"
Rename-Item $xmlpath -NewName $skypedir\config_old.xml -Force
gc $xmlbackup| ? {$_ -notmatch "Advert*"} | Out-File $xmlpath
Set-ItemProperty -Path $xmlpath -Name IsReadOnly -Value $true
Write-Host -ForegroundColor Green "Let's hope the ribbons are gone. If they're not, I don't think there's much more I can do. Give it a go :-)"
} else {
Write-Host -ForegroundColor Green "Bye :-)"
} catch {
write-host -ForegroundColor Red "If I was you, I'd remove all that stuff manually. This script is clearly not made for your computer :-P"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.