Category: Uncategorized

Re-install Windows 10 Store

We recently switched domains to have a central domain name instead of a location dependent setup. Whilst using a user profile migration tool, we came across a bug where the Windows Store would either disappear or just be unusable. This means that several useful applications for the end-users would stop working, for example : Sticky Notes, Calculator and even Microsoft Photos.

The solution was to download all the packages again and reset the store.

Run the below from powershell (run as admin) to download/install all packages

Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”} 

The above command might throw a few errors, but will still complete. Once done, run the below from a command prompt ( run as admin )

wsreset

Once you have run the wsreset, you should either see the Store open up automatically or you’ll be able to find it to install all the applications required again.

SFTP Automatic using winSCP


This script is partially generated from WinSCP automation, however has been modified to put two files onto the remote server with a timestamp and remove any files which are over 14 Days old in that specific remote directory.

Please note that the SSH-RSA key has to be changed to match your host being accessed by winscp.

@echo off
“C:\Program Files (x86)\WinSCP\WinSCP.com” ^
/command ^
“open sftp://YOURUSERNAME:[email protected]/ -hostkey=””ssh-rsa 2048 X7f9U4Io2IKF8G/m/OenvXvkDGuMGm0PI5b0/BGOpRM=”” -rawsettings FSProtocol=2″ ^
“lcd “”E:\YOURFOLDER””” ^
“cd /REMOTEFOLDER” ^
“put “”FILE1.csv”” “”FILE1%%TIMESTAMP#yyyymmdd%%.csv”” ” ^
“put “”FILE2.csv”” “”FILE2%%TIMESTAMP#yyyymmdd%%.csv”” ” ^
“rm *<14D ” ^
“exit”


set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%

Mikrotik Router hijack fix

Mikrotik routers recently came under attack some time ago. An exploit was found to gain administrative access to them and would link them to a larger botnet network. The below will potentially help in removing the intruder and disable the security hole used by them to gain access. You should also upgrade the router to the latest available firmware

/sys backup save
/ip socks set enabled=no
/sys scheduler remove rsched1_
/sys scheduler remove schedule3_
/sys script remove script3_
/sys script remove rscript1_
/file remove mikrotik.php

Disable the services which are not required, only winbox allowed
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes

Commands explained – 

First we take a backup, then disable the ip socks feature. We remove the maliciously scheduled tasks and scripts and also remove the un-needed mikrotik.php file. Lastly we are disabling all the services which shouldn’t need to be activated on the firewall/router.