Adding MAC addresses to PHPIPAM using ARP

Posted on .

After finding this feature wasn’t implemented [1][2], I spent some time this evening learning phpIPAM‘s REST API and writing a short bash script to update phpIPAM’s mac field.

  • The script will need the username and password of a user that has write permission to the addresses you want to update.
  • You will need to create an api app, as described in the documentation.
  • The script gets info on a single interface and updates addresses in a single subnet.
  • The script will check that the mac needs updating and only update if necessery.
  • The script will ignore addresses tagged as (3) “reserved” or (4) “dhcp”.
  • The script won’t add new addresses, only update existing ones.
  • The script will check local interface ips as well (as these aren’t in ARP)
  • The script requires “iproute2”, “curl” and “jq” (Command-line JSON processor).

Code available at https://github.com/lazynooblet/scripts/tree/main/bash/phpipam-update-mac-from-arp

VBScript wrapper for PowerShell scripts to hide window

Posted on .

Even with PowerShell’s command-line argument “NoWindow”, a minimized powershell prompt is seen briefly by the user.

Using VBScripts ability to load console applications completely hidden, we can run PowerShell without interrupting the user.

The VBScript takes a single argument which is the filename of the powershell script. The VBScript needs to be in the same folder as the powershell script as it will work out its own scriptpath and use this to find the PowerShell script.

Minimize applications with PowerShell

Posted on .

I have adjusted the previous 3CX script from 2020 to simply minimize a list of applications. The script will search for matching processes for up to 30 seconds and minimize them. I have this script run on logon. It currently minimizes both 3CX and Voicemeeter Macro Button app.

Automatically minimize 3CX Phone for Windows

Posted on .

One of the popular requests from users over at the 3CX forum is how to load up the client minimized. See https://www.google.com/search?q=3cx+minimize+on+startup

Today I’ve written some powershell that when also run at startup will close the 3CX Phone for Windows application automatically. I run this as a scheduled task triggered on login.

The script first checks if 3CX is currently setup to start automatically, and if not, will start 3CX Phone for Windows.

The script then checks once a second for the app to load and will close to tray. The script will wait $wait seconds before closing if the app is not loaded.

Renaming a Domain Controller

Posted on .

You can use netdom to rename any computer, including a domain controller:

However this will leave the attribute msDS-AdditionalDnsHostName with the old name. Check this in ADUC attribute editor (or ADSIEDIT.msc):

Remove the old name and restart.

PS. This fixes not being able to re-use the old name on another computer. You get the error The operation failed because SPN value provided for addition/modification is not unique forest-wide, and you will see the old domain name when you run setspn -l <oldname>. Performing the above attribute changes fixes this.