The Things Network – A Global IoT network

Me and my friend Christoffer has looking into some Internet Of Things stuff and one of the biggest problems with get “things” on to the internet is that its cost many and battery.

Now we find a way to do it sheep and battery low using, with the community driving “The Things Network”.

Together a community of people all around the globe building gateways and letting people connect to there gateways to send small amount of data to the the network.

All data is encrypted so the gateway owner only seeing package of data delivered but not what it sent.

I was the first person in Nyköping to put up a gateway for this “The Things Network” using a Pycom LoPy unit that talks LoraWan, Wifi and Bluetooth.

The Things Network using LoraWan to talks to units, in Europe with a frquency of 868 MHz and the gateway also connects to the wifi to get conenct to internet and the network.

Then i have a another Pycom Lopy i setup as a node and have going around the apartment and scanning of how long the conneciton works. Really good i most say, here is a signal map:

The next step in ths project is to make the node sendning out events from a magnetic sensor that i like to add on my door to know when the door opens and closes and maybe another sensor on the mail inbox.

On tip, after follow the “Get started” tutorials and the node don´t like to join the network but the node is conencted tot he gateway and only sending  activating requests.

Then open up the port 1700 with both TCP and UDP to the gateway ip-number.

Microsoft Exchange Server 2016 shell commands that can be good to know

List all mailbox databases in the organisation
Get-MailboxDatabase

List all mailbox databases with paths
Get-MailboxDatabase | fl Name,EdbFilePath,LogFolderPath

List all mailbox databases with informations about them
Get-MailboxDatabase -status | fl *

Show mailbox databases and the backup status
Get-MailboxDatabase -status | ft server,name,LastFullBackup,LastIncrementalBackup,DatabaseSize

Change name of a mailbox database
Set-MailboxDatabase “Mailbox Database 1721414988” -Name “DB02”

Change database and log ptah of a mailbox database
Move-DatabasePath DB02 -EdbFilePath M:\DB02\DB02.edb -LogFolderPath N:\DB02

Change the queue and queue log path
Create the directories, example:

  • mkdir “Q:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue”
  • mkdir “R:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue”

Give “Network service” full control of this directories.
Open the file %ExchangeInstallPath%Bin\EdgeTransport.exe.config in notepad
Change the paths on the rows looks like below

  • <add key=”QueueDatabasePath” value=”Q:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />
  • <add key=”QueueDatabaseLoggingPath” value=”R:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />

After this changes you need to restart the transport service

Move system mailboxes to a new mailbox database
Get-Mailbox -Arbitration | New-MoveRequest -TargetDatabase DB02

Clean up completed move requests
Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

Show all e-mail accounts/recipients with e-mail addresses
Get-Recipient | Select Name, EmailAddresses

Show all mailboxes in a mailbox database
Get-Mailbox -Database “Mailbox Database”

Show the mail queue
Get-Queue

How to make a unattended uninstallation of Microsoft Exchange Server 2016?

I was running the uninstallation of a Microsoft Exchange Server 2016 and the server crash and reboot.

After the reboot i try to start the uninstallation again and only got “An incomplete installation was detected. Run setup to complete Exchange Installation.”

When try to run the setup from the installation DVD/ISO it not starts so i search for help and find out that i could start a unattended uninstallation by starting a Command prompt as adminsitrator and go to where the setup.exe file is on the DVD and then run the command:

  • Setup.exe /mode:Uninstall /IAcceptExchangeServerLicenseTerms

Then it start running “Welcome to Microsoft Exchange Server 2016 Unattended Setup”.

How to force removal of Exchange Server Mailbox database?

I have got some problems with one of my mailbox databases on my Microsoft Exchange Server 2016 server, its has been corrupt for some months without me could repair it and now it was time to remove the whole Exchange server from the organisation.

So i tested everything and search for some help and after some time i find out that you can force the removla of a exchange server mailbox database from the ADSI Edit tool.

Practical you telling the AD to remove the knowledge of the database with this hack.

  • Start with log on to the Domain Controller
  • From the start menu select run and enter adsiedit.msc and press run button.
  • In the tool, right-click ADSI Edit and select Connect to.
  • In the “Connection Settings”-dialog under “Select a well known Naming Context” select Configuration and click OK.
  • Navigate to CN=Configuration [domain] → CN=Services → CN=Microsoft Exchange → CN=[organization] → CN=Administrative Groups → CN=Databases
  • Identify the Mailbox Database containers that you like to remove and delete them.

Make sure that you are not deleting working mailboxes from the list, if you delete any by mistake you will have to delete & recreate the entire user using Active Directory Users & Computers.

How to activate SSH on Rasbian for Raspberry Pi from first boot?

I have a Raspberry Pi Zero Wireless that i have got to connect to my wifi direct on first bott (see this post) and then i liked to get the SSH activated from the first boot also.

After some searching i find out that you can put a file named ssh without any file extension in the boot partition.

Raspbian then going to activate SSH on the first boot so no need to put in any keyboard and monitor to activate it.

The content of the file doesn´t matter, it could contain either text or nothing at all.

How to get a Raspberry Pi Zero Wireless to connect to wifi automaticly on first boot

Raspberry Pi Zero Wireless is a very nice Internet of Things computer but its only has mini-hdmi and micro-usb connectors wish make it not so easy to connect to configure to get it up on wifi but after som research i find out that it is possible to configure it to connect to wifi from the first boot of Rasbian.

Rasbian has built in that it copy wifi details from /boot/wpa_supplicant.conf into /etc/wpa_supplicant/wpa_supplicant.conf to automatically configure wireless network access.

If a wpa_supplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpa_supplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition.

Since the /boot partition is accessible by any computer with an SD card reader, wifi configuration is now much simpler.

A skeleton wpa_supplicant.conf file can be as little as:

network={
ssid=”YOUR_SSID”
psk=”YOUR_PASSWORD”
key_mgmt=WPA-PSK
}

If you use WPA2-Personal settings with AES you can set the config file to have this text:

network={
ssid=”Your SSID Here”
psk=”YourPresharedKeyHere”
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
}

I can also recommend to read my post of how to activate the SSH on first boot, click here.

How to make a bootable Windows installtion USB stick

Aftrer some searching i find there is some commands that are differents between how people make there own windows installation usb stick, so i taked the one i got to work and write it here.

Start with put in a USB stick to the computer then you should open a command prompt as administrator.

When you have the command prompt  you follow the steps below:

  • DISKPART
  • LIST DISK
    • Find your usb stick in the list
  • SELECT DISK 1
    • Replace DISK 1 with the number your usb stick has
  • CLEAN
  • CREATE PARTITION PRIMARY
  • SELECT PARTITION 1
  • ACTIVE
  • FORMAT FS=NTFS QUICK
  • ASSIGN
  • EXIT

Don´t close the command prompt.

Mount the ISO or put in your DVD disc so its comming up in “This computer” and remember the drive letter on it and on your USB stick.

Write in your command prompt:

  • G:
    • Where G: is your drive letter of your DVD-Rom
  • CD BOOT
  • BOOTSECT.EXE /NT60 H:
    • Where H: is the drive letter on the USB stick)

Now you have a bootable USB stick, now you have to copy the windows installation files.

  • xcopy /h /E /s G:\ H:\
Now you have your own bootable USB stick with your windows installation, now you can restart the computer you like to install it on and setup the BIOS/UEFI to boot from the USB stick.
This is original taken from a tutorial for Windows 7 but i have personally used this tutorial for all kind of Windows versions (8, 8.1, 10, Windows Server 2012, 2016).