Adding PXE server into a Unifi Security Gateway

So I’m in the process of setting up a PXE Server on my network. I have a Debian based TFTP server that I created without DHCP setup on it. Mainly because I want the USG to do most of the work.

So of course I went looking around the web to do this first. Which I really couldn’t find anything on how to do it, which of course lead me to an important lesson. Always look through the settings first. 🙂

So here’s what you need to do.

  • Log into your Unifi system
  • Then click network
  • Then click edit for the lan you want the pxe server to be on
  • Then click advanced DHCP options.

  • Click enable network boot. Enter the ip of the server as well as the file it will be booting. In my case currently I have just one linux distro in there.
  • Under DHCP TFTP Server put in the ip address of the PXE server as well.

And then you should be good to go provided you set up your PXE Server correctly.

Microsoft Windows & Office ISO Download tool

While I have most of the ISOs of windows versions there are times where I need to get another copy. Maybe it’s got a corrupt version, or I need a weird version of windows etc.

So this tool is one of the important ones I use to get an ISO file

It’s called the Windows and Office ISO Download tool. And it can be downloaded here.

It’s works nice and allows you get get a wide range of ISOs from Microsoft.

Script to keep Hamachi alive

We use hamachi by logmein at work for various things, but one of the problems with hamachi at times is sometimes the tunneling engine doesn’t start. Now previously I had created a batch file that did this job, but it was pieced together with code I found online. So overall it was complicated.

So I wanted to redo it in powershell as well  make it give some kind of message in case someone else was needing to run this script.

So here it is

while ($true) {

if (-not (Test-Connection '192.168.0.207' -Quiet)) {

Write-Host "Test failed: $(Get-Date -Format "MM/dd hh:mm tt")"

Write-Host "Restarting Hamachi..." -ForegroundColor Red

Restart-Service Hamachi2Svc
Start-Sleep -Seconds 60

}

else {

Write-Host "Connection test passed: $(Get-Date -Format "MM/dd hh:mm tt")"

Start-Sleep -Seconds 600

}

}

It does need to be ran as an admin and I’ve got it set up as scheduled task for when the computer reboots.

The line that says

Start-Sleep -Seconds 60

is how long it will wait for hamachi to restart before it tries again. In my case it seems 60 seconds is plenty of time, but you may want to bump the time up a bit if needed.

Run a powershell script in task scheduler without it poping up.

I run some powershell scripts at work to keep things running and do things automatically. Problem when you put them in a task scheduler they pop up on the screen when they run.

So here’s what I found that works to keep them from showing up.

Open up the properties of a scheduled task

in the program/script section put

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

for arguments  put in

-File "C:\folder_of_script\script.ps1"

for start in put

c:\folder_of_scripts\

And that’s all there is to it.