Sometimes, running remote code with the PowerShell cmdlet Invoke-Command can take a long time to run—and not for any...
Tag Archive for: powershell cmdlets
4sysops - The online community for SysAdmins and DevOps
Managing the Windows Firewall with PowerShell

It is well known that you can manage the Windows Firewall with the MMC snap-in and the command line...
Measure-Object: Computing the size of folders and files in PowerShell

If you want to know the total size of all files in a particular folder, you can easily do...
Recursive PowerShell functions and Get-PSCallStack

Sometimes a PowerShell function needs to call itself to continue processing. Although we should avoid creating recursive functions (if...
Search Active Directory with the PowerShell cmdlet Get‑ADComputer

If you work with Active Directory (AD), Get-ADComputer is a PowerShell cmdlet you will use at some point to...
Read-Host and the ChoiceDescription class – Prompt for user input in PowerShell

The Read-Host cmdlet allows prompting for user input in PowerShell. With the help of the .NET ChoiceDescription class, you...
The Disable-PSRemoting warning

Warning: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting or Enable-PSSession Configuration cmdlet....
Measure objects in PowerShell with the Measure-Object cmdlet

According to the help content, Measure-Object 'calculates the numeric properties of objects, and the characters, words, and lines in...
Sort data with PowerShell

Like most command interpreters and script languages, PowerShell lets you sort file contents or command outputs. In addition to...
PowerShell transcript – Record a session to a text file

The Start-Transcript and Stop-transcript cmdlets let you record all of your activities in the PowerShell console to a text...
Import and export a CSV file to a PowerShell object

The PowerShell cmdlet Import-Csv allows you to import a CSV file to a custom PowerShell object easily. And with...
Add a calculated property with Select-Object in PowerShell

With the help of the Select-Object cmdlet, you can add a calculated property to the output of a PowerShell...
The PowerShell WhatIf parameter

PowerShell has built-in functionality for all of its cmdlets and advanced functions, known as the WhatIf parameter. The WhatIf...
The new local user and group cmdlets in PowerShell 5.1

With the recent release of PowerShell 5.1—part of Windows Management Framework (WMF) 5.1—Microsoft introduced new cmdlets for working with...
Zip and unzip with PowerShell

The cmdlet Compress-Archive and Expand-Archive have been introduced in PowerShell 5 and allow you to easily zip (compress) and...
Compare data with PowerShell

PowerShell offers multiple options to test whether files are identical or not. If you only need this kind of...
Copy-Item, Move-Item – Copy and move files with PowerShell

PowerShell offers a whole collection of file management cmdlets. To copy and move files, you can use Copy-Item and...
Where-Object – Filter data with PowerShell

Cmdlets usually return a large collection of objects, but often you only need a few of them. In these...
Use PowerShell Invoke-Command to run scripts on remote computers

The Invoke-Command cmdlet is one way to leverage PowerShell Remoting. In today’s post, I will give you an overview...
Display and search all variables of a PowerShell script with Get-Variable

If you have to debug a PowerShell script, it is helpful to display all its variables with their values....