PowerShell: automatically delete files older than X days

In this tutorial, we will see how to delete files older than X day using PowerShell. This type of script is often used in businesses on servers to rotate logs. If we take the example of IIS, the logs are never deleted, which means that after 3 years, we end up with more than 1,000 …

Read more



ARR: Block PowerShell access to Exchange

In this tutorial, I will show you how to block PowerShell remote access to Exchange with ARR. As a security measure, if you use IIS ARR to publish Exchange servers to the Internet, you must block PowerShell remote access. By default, it is possible to remotely administer an Exchange server with PowerShell, we find all …

Read more



Active Directory: retrieve the base DN (distinguishedName) attribute of an object

In this tutorial, I will explain how to retrieve the base DN also called distinguishedName in an Active Directory. This attribute is often used to configure LDAP/Active Directory bindings for applications. All Active Directory objects (Users, Computers, Organizational Unit, etc.) have the attribute: distinguishedName and this is unique. I say that the base DN attribute …

Read more



Exchange 2016: Enable Extended Protection

In this tutorial, I will explain to you how to activate extended protection (Exchange Extended Protection) on Exchange 2016 (and 2019 if you do not have CU14 which automatically activates it) which will allow you to protect yourself from CVE-2024 -21410. Exchange Extended Protection is in fact an enhanced security configuration for Exchange 2016 / …

Read more



Active Directory: create an organizational unit (OU) in PowerShell

In this “How to” tutorial, we will see how to create an Organizational Unit in an Active Directory with the New-ADOrganizationalUnit cmdlet. Create an OU in PowerShell Open a PowerShell command prompt From a domain controller open a PowerShell window Use the New-ADOrganizationalUnit Cmdlet to Create the OU Enter the following command by adapting the …

Read more



PowerShell: sign scripts

In this tutorial, I will explain how to sign your scripts. Before going into the subject, we will see why signing the scripts, the main reason is security. If your environment (computers + servers) is configured to run only signed scripts and a PowerShell script is launched in a malicious file, it will be neutralized …

Read more



PowerShell: download a file in HTTP, HTTPS

In this tutorial, I will explain how to download a file using PowerShell that is on a server accessible in HTTP or HTTPS. This can be particularly useful when administering a server without an interface, where the only browser installed is Internet Explorer or in a script. There are several solutions to download one using …

Read more



Install nano on Windows

In this tutorial, I will explain how to easily install nano on Windows (Desktop and Server). If you regularly use Linux, you are certainly familiar with it, for those who do not know nano, it is a command line text editor and it must be said that sometimes it is missing on Windows, particularly when …

Read more



PowerShell: show the contents of a text file

In this tutorial, I will show you how to display the contents of a text file (txt, yaml, php, vbs…) in a PowerShell window. In fact, it’s very simple, just use the Cmdlet Get-Content and specify the file name. Which give : If you are familiar with the cat command in Linux, you can also …

Read more