How to see the last logon for a user in Windows

I wanted to see the last time a user had connected to a server that was not on the domain. Use the command below to see the login time, replacing USERNAME with the actual username. This will also work on a domain, but if you have more than one DC you will need to run it on each DC.

net user USERNAME | findstr /B /C:”Last logon”

On a domain joined PC use the command below to find out the last time it logged on to the domain . DO NOT REPLACE THE WORD “DOMAIN” WITH YOUR DOMAIN NAME THOUGH!!

net user USERNAME /DOMAIN| findstr /B /C:”Last logon”

How to fix ” Last error: 8457 (0x2109): The destination server is currently rejecting replication requests.”replication issue with Windows 2012 domain controllers

I had a DC that wouldn’t replicate with other domain controllers and was causing issues.

I ran repadmin /showrepl  form a Powershell prompt and saw the following error being returned on the screen

Last error: 8457 (0x2109): The destination server is currently rejecting replication requests.


To fix this , run the following commands and replace the <DC NAME> with the name of your DC. Replication should begin again soon.

repadmin /options <DC NAME> -disable_inbound_repl
repadmin /options <DC NAME> -disable_outbound_repl

How to fix re-appearing deleted calendar items in Outlook using Exchange 2013

We have a shared mailbox that is used for it’s calendar function for booking in training.

We had a user who would delete canceled training, then the next day the appointment would be back in the calendar!

The reason for this is that Exchange has an automated “calendar repair assistant” that runs each night and checks calendars and repairs them if it finds inconsistencies.

To turn this off on a mailbox, simply run the following Exchange Powershell command: remember to replace MAILBOX with the name of the mailbox that you wish to modify.

Set-Mailbox -Identity MAILBOX -CalendarRepairDisabled $true

How to specifically ping an IPV4 or IPV6 address

Sometimes when you ping a computer , you will get an IPV6 repsonse which may not be much help to you.

To specifically get an IPV4  IP address back, do the following.

ping -4 hostname    For example:    ping -4

To specifically get an IPV6  IP address back, do the following.

ping -6 hostname    For example:    ping -6

How to fix “fatal error: cannot allocate memory for the buffer pool” with mysql on AWS micro instance

I had a problem with an AWS Micro instance running WordPress on Ubuntu Linux where mysql would shut down randomly, at least once per week.

Looking in the error.log file I found the following error  “fatal error: cannot allocate memory for the buffer pool”  and “InnoDB: mmap(137363456 bytes) failed; errno 12

I did some research and found that an Ubuntu micro instance doesn’t have a swap file configure due to it’s low memory capacity.

TO create a swap file, type the following commands:

  1. sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
  2. sudo mkswap /swapfile
  3. sudo swapon /swapfile
  4. Add this line: /swapfile swap swap defaults 0 0 to /etc/fstab

How to enable NetFlow on a Cisco router

I wanted to be able to work out how much internet bandwidth I was using via a Cisco router. To do this i needed to turn on NetFlow and then send that data to Solarwinds Network Traffic Analyzer.Here are the steps.

Log into your router.

Enter global configuration mode (configure terminal)

Enable NetFlow for each interface(in this case Dialer0) by typing: interface Dialer0

Then type: ip route-cache flow

type exit

then type (replacing with the ip adderess the analyzer server) : ip flow-export destination