Skip to content

Powershell

Automating Mod Downloads from Curseforge for Servers

I like modded Mincraft. I was trying to setup a modded server from Curseforge and found out that there are a number of mods that are flagged to not auto download with the rest of the pack. During the server pack install a file called "MODS_NEED_DOWNLOAD.txt" will be created containing various mods that meed this criteria. The expectation being you need to download each one and copy it to the server pack mods directory.

Poor Mans Connection Monitoring

This morning I had need to be alerted if I ping starts failing in an ad-hoc situation. The below script does a test ping and then beeps if the ping fails. It'll loop endlessly.

while ($true) {
    $ping = Test-Connection -ComputerName 10.120.10.100 -Count 1
    $ping
    Start-Sleep -Seconds 1
    If (($ping -eq "") -or ($ping -eq $null)) {
        [console]::beep(500,1000)
    }
}

Greenshot Intune Deployment

Greenshot is a very nice program. However there is one thing that REALLY annoys me about it. The hard coded browser poppup after install. Deploying Greenshot via Intune is not the most straight foward thing if you want to customize the install. Plus there is having to kill greenshot running under the deploy account (usually system) and also starting greenshot under the current logged on user after install.

For this I used this intune winget template. It consists of your usual detection, install, and uninstall scripts. Below I'll be going over the install script.

Force AD Replication

The below script will get all domain controllers in the current domain and then run a repadmin /syncall on all of them.

(Get-ADDomainController -Filter *).Name | Foreach-Object {
    repadmin /syncall $_ (Get-ADDomain).DistinguishedName /e /A | Out-Null
}