PowerShell Archive

The Basics of PowerShell DSC (Desired State Configuration)

Desired State Configuration (DSC) allows you to configure Windows and applications using a configuration file and PowerShell. As in other configuration management systems (for example, Puppet or Ansible), when using Desired State Configuration, the administrator can describe the required configuration (target state) in the configuration file, and then use...

Configuring Domain Password Expiration Policy

In the Active Directory domain, a password expiration policy can be configured that forces the user to change the password when his password expires. What happens when a user password is expires in Active Directory? The user account is not blocked, user must change password at next logon: Your...

“User Must Change Password at Next Logon” Option Not Working/Grayed Out

The option “User must change password at next logon” is usually enabled when creating a new Active Directory user, when the administrator resets the user’s password (when the user forgot his password or the password was compromised). You can enable the option “User must change password at next logon”...

PowerShell: Move Computer to OU

By default, when you join a new computer or server to the Active Directory domain (through the properties of the computer), it creates the computer object in the Computers root container. If you use a complex Active Directory Organizational Unit (OU) structure in your domain with various Group Policies,...

How to Create Office 365 Group?

Office 365 groups are objects that contain user lists. Office 365 groups used to share resources within and across different Azure apps (Teams, Outlook, OneDrive, OneNote, Skype for Business, Power BI, Dynamics CRM, etc.) and the organizations. Office 365 groups are stored in Azure Active Directory and can be...

How to Get Windows 10 User Login History Using PowerShell?

On Windows, you can track user login and logoff events using the Security log. In this article, we’ll show you how to get user login/logoff history from Event Logs on the local computer using simple PowerShell script. In order the user logon/logoff events to be displayed in the Security...

Get-service: Checking the Status of Windows Services with PowerShell

You can use the Get-Service cmdlet to get a list of all the services installed on the Windows operating systems, their status and startup type. This one and other cmdlets to get the status and management of Windows services first time appeared in Powershell 1.0. In this article we...

How to Create a GUI for PowerShell Scripts?

One of the significant drawbacks of PowerShell scripts, when used by users (not sysadmins or programmers), is its command-line interface. The result of the scripts is displayed in the PowerShell CLI console and it is not always convenient for the end user. However, Powershell is a powerful and modern...

How to Check Windows Uptime?

Uptime is the measure of the uninterrupted time that an operating system experiences since the last boot. Unlike Linux/Unix, Windows doesn’t have a native uptime command. On Windows, you can get the computer uptime value in several different ways: from the GUI, command prompt, or PowerShell. Let’s consider all...

PowerShell Comparison Operators

PowerShell comparison operators allow you to find out if the value of a variable contains a string, is it larger, smaller, or equal to some value, etc. Most programming languages use symbols as comparison operators, like <, >, !=, =, however, in PowerShell, pseudo-commands are used instead of these...