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

PowerShell

PowerShell scripting and code snippets, examples and info for Windows Server administrators. Might contain some AppCmd and DISM as well.

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

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!

Add websites and application pools to IIS with PowerShell, in a for loop

Microsoft Internet Information Services logo

How to use PowerShell to create websites and application pools in IIS… A client of the company I work for wanted to quickly add 60 sub-domains to his website. But, the sub-domains had to be created as self contained IIS websites, and running in their own application pools. Luckily, the client wanted 60 consecutive sub-domain names, e.g. “sub01.example.com”, “sub02.example.com”, …, … up till “sub60.example.com”. This made our task a bit easier, because we could easily script this in PowerShell

Scroll to Top