Kasraeian

vWorld v.3

Disabling upload feature for ShareX

There’s a free interesting application called “ShareX” which is great for lots of different tasks such as “screen shot, screen recording, file uploading and etc.”.

If you interested on automatically uploads new screen shots online and share, then you might find this application very useful. One of useful feature in this application is the upload capability and you can select between different targets and by default it has been configured to upload any new screen shot to a specific host “imgur“.

For security reason, this should be disabled by default and users be able to decide if they want to enable it or not, but for some reason “ShareX” decided to publish their application with this feature on by default.

Long story short, I made a below PowerShell script which would look for “ShareX” configuration and it’d disable this capability for all users who ran this application before.

clear
$users = Get-ChildItem "c:\users\"
#$users.Name
foreach ($user in $users) {
  $trgt = "C:\users\$user\Documents\ShareX\ApplicationConfig.json"
  $trgt_bkp = "C:\users\$user\Documents\ShareX\ApplicationConfig_backup_json"
  if (Test-Path $trgt) {
    Copy-Item $trgt $trgt_bkp -Force -Confirm:$false
    Write-Host -ForegroundColor Green $user": File exist and backup created"
    (Get-Content $trgt).Replace('"DisableUpload": false,','"DisableUpload": true,') | Set-Content $trgt
    Write-Host -ForegroundColor Green "File modified"
  } else {
    Write-Host -ForegroundColor Yellow $user": File not exist; nothing to change."
  }
}

Hope you find it useful.

It's your kindness to leave a reply/feedback

Kasraeian © 2016-2018
%d bloggers like this: