You are here: Sysadmins of the North » PowerShell


PowerShell Tag Archive

You are here: Sysadmins of the North » PowerShell

Get SQL database backup details with PowerShell

Microsoft SQL Server logo

Learn how to query the .bak file for header information. Whenever I need to restore an SQL Server .bak backup file, I want to know some properties of the backup file to make sure I’m working with the correct file(s). Luckily, the .bak file and PowerShell provide all the information I need, so I don’t have to start a Restore procedure in SQL Server Management Studio (SSMS) just to view the header information. As you know, SSMS is slow…

Get IIS Current Connections using PowerShell

Do you want to know how to get the current number of connections to IIS hosted websites? The information is stored in Windows Server Performance Counters, and you can get it using Get-Counter cmdlet in PowerShell of course. But in post I’ll show you a different -and perhaps even faster- method using WMI/CIM and Win32_PerfRawData_W3SVC_WebService. Read on…

Install Windows Updates using PowerShell

You can use PowerShell to install Windows Updates automatically, unattended and simple. Neat, right? For this, you don’t have to have an enterprise environment with WSUS, or Windows Server, but since this is Sysadmins of the North, I assume you do. In this post I’m going to show you how to install Windows Updates with PowerShell and the PSWindowsUpdate module.

Monitor .NET CLR Garbage Collected heap from your web application

Are you worried about your .NET webapp running out of memory? In order to let your .NET (web) application run smooth over a longer period of time, it is important to monitor the .NET CLR Garbage Collector (GC) and collection. The what? The .NET Common Language Runtime Garbage Collector. Here is how you can monitor this in a Zabbix template using Powershell WMI / CIM and Win32_PerfRawData_NETFramework_NETCLRMemory Windows Performance Counters.

Retrieve SSH public key from Active Directory for SSH authentication

OpenSSH logo

If you want to be able to log on to your Windows Servers through Win32 OpenSSH, you can make use of SSH public key authentication through a ~/.ssh/authorized_keys file. But if you have tens (hundreds) of servers and/or users, perhaps it’s easier to retrieve user SSH public keys from Active Directory (AD). In this article I’ll explain how.

How to add, list and remove IP addresses in Windows Firewall

Yesterday, I showed you how to block IP addresses in Windows Firewall using PowerShell. This comes in handy when blocking IP addresses that are brute-force attacking your servers. In this short post I’ll show you how to bulk add IP addresses in Windows Firewall, list an IP address and how to remove all IP addresses from Windows Defender Firewall with Advanced Security.

Block brute force attacks on SQL Server, block IP addresses in Windows Firewall using PowerShell

Access blocked

This PowerShell solution blocks IP addresses that are trying to brute force your SQL Server logins, by blocking IP addresses in Windows Defender Firewall with Advanced Security. For the time being, some manual labor is involved, but it is still manageable. You can use this to create your own solution to block offending IP addresses in SQL Server’s firewall.

Scroll to Top