You are here: Sysadmins of the North » Code base » Page 2

Code base

Code base for PowerShell scripting, PHP, ASP/VBScript, ASP.NET/C#, ASP.NET Core, Perl, code snippets and examples. Snippets are small pieces of reusable code.

You are here: Sysadmins of the North » Code base » Page 2

PowerShell blacklist check script: find an IP address’ blacklist status & reputation

Here’s a blacklist check script written in PowerShell. You can use this to lookup an IP address in various blacklists (DNSBL, RBL). Such a check is a great indicator for an IP address’ reputation. Basically this PowerShell blacklist checker is a port of my Bash script to check an IP address blacklist status in Linux.

Simple PowerShell introduction for Windows Server administration, automation and scripting

PowerShell 5.0

Here is a small and simple introduction to Windows PowerShell. Windows PowerShell is an important tool in Windows Server for administrators. You can use PowerShell for Windows Server administration, software installation, automation, and shell/command-line scripting.

Get Hyper-V guest serial number with PowerShell

PowerShell 5.0

Learn how to retrieve the Hyper-V virtual machine’s serial number with PowerShell. Sometimes you need to have the serial number of a Hyper-V virtual machine (VM, or guest). We, for instance, use this serial number in our automatic, unattended deployment of the guest operating system. But then you need to know how to find this serial number…

Monitor Windows services with PowerShell

As a Windows Server and IIS administrator, you want your Windows services to run at all times. One can monitor Windows services in many, many, ways. Some of our customers websites may depend on certain services, which may be hard to monitor externally. For those Windows services that need local monitoring, I like to schedule a PowerShell script. Here is one…

PowerShell Get-FsrmQuota and Set-FsrmQuota

To get and set File Server Resource Manager NTFS quota, you now have to use PowerShell‘s FileServerResourceManager cmdlets. In the past, I used to get and set NTFS directory quota with the dirquota command, which is deprecated. A behavioral change for me (and you?) I can live with: it’s pretty easy to get directory information with Get-FsrmQuota and change dirquota using Set-FsrmQuota.

Set IIS Application Pool recycle defaults to Specific Times, not Regular Time Interval

Application Pool Specific Time Interval recycle settings

By default, an IIS application pool (or “AppPool”) recycles on a regular time interval of 1740 minutes, or 29 hours. One reason for this time interval is that application pools don’t recycle at the same moment every day (every day at 07.00 for example). However, sometimes you want to change this regular time interval to a specific time schedule. And when you try to configure this in IIS Manager, it gives you an error. Luckily, AppCmd and PowerShell come to the rescue!

How to set a good PHP realpath_cache_size

get current PHP realpath_cache_size value

The PHP directive realpath_cache_size sets the size of the realpath cache to be used by PHP. Increasing realpath_cache_size might greatly improve PHP performance, as PHP states: “This value should be increased on systems where PHP opens many files.”. Therefore, setting a correct value for PHP realpath_cache_size can greatly improve PHP performance and optimize WordPress – and other CMS’s – websites.

Redirect old URL to new URL or send 404 page with PHP

black traffic light under blue sky

Redirect pages with PHP. If you’ve moved some old PHP pages, or URLs, to new pages and URLs, you can use the following PHP code snippet to easily redirect all visitors and incoming requests to the new location. This PHP code snippet uses a 301 Moved Permanently redirect, perfect for SEO and returns a 404 Not Found if a new location hasn’t been set up yet.

Scroll to Top