Month: March 2019

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%

Generating a CSR to use with your own CA

This method of generating the certificate with this CSR is useful when using for a web server, as without specifying the req_ext “SAN”, most popular browsers will display an error “ERR:certificate_common_name_invalid”

[ req ]
default_bits = 4096
prompt = no
encrypt_key = no
default_md = sha256
distinguished_name = dn
req_extensions = req_ext

[ dn ]
CN = example.com
emailAddress = [email protected]
O = Example
Company OU = Example Unit
L = City
ST = State
C = US
[ req_ext ]
subjectAltName = DNS: www.example.com, DNS: mail.example.com, DNS: files.example.com

Fill in the above with relevant details and save it as yourdomain.com.conf Then, run OpenSSL using the below command :

openssl req -new -config yourdomain.com.conf -keyout yourdomain.com.key -out yourdomain.com.csr 

If you are doing this for an Apache web server, you’ll have to make sure you have the a2enmod ssl enabled and add the below to your VirtualHost configuration file

 SSLEngine on
SSLCertificateFile /home/user/certificates/yourhostcert.crt
SSLCertificateKeyFile /home/user/certificates /yourdomain.com.key
SSLCertificateChainFile /home/user/certificates/root_combined.cer

SNMP V3 on Ubuntu

We will be installing 3 packages to get SNMP up and running on Linux.

apt install snmpd snmp libsnmp-dev

OR

yum -y install net-snmp net-snmp-utils (if you are running yum)

Copy the default snmpd config file for backup purposes ( if you want to )

cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak

Empty the file out by doing the below

cat /dev/null > /etc/snmp/snmpd.conf

Stop the running service of snmpd by issuing the command

systemctl stop snmpd

Create your read only user account for SNMP V3. Replace “SUPERPASSWORD” and “USERNAME” with your required information

net-snmp-create-v3-user -ro -A SUPERPASSWORD -a SHA -X SUPERPASSWORD -x AES USERNAME

Now make the service start on bootup

systemctl enable snmpd

Start the service!

systemctl start snmpd