Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

PowerTip: Get a list of local Users in Windows 10 / Windows Server 2016

Summary: Use the cmdlets provided in PowerShell 5.1 to manage local user accounts on a system. (image) I remember having to use the Active Directory Service Interfaces (ADSI) accelerator to access a list of local users in PowerShell. Is there a cmdlet that could do this now? (image) Yes.  In the most recent version of Windows 10 / Windows ...

PowerTip: List locked-out accounts in Active Directory with PowerShell

Summary: Use Active Directory cmdlets to identify locked-out user accounts and computer accounts. (image) Is there a quick and easy way to find all users who are locked out in Active Directory by using PowerShell?   (image) You’ll love this. The answer is just one cmdlet away with the ActiveDirectory module. Just use Search-...

PowerTip: Limit Get-Childitem to a limited depth in the tree

Summary: Use the new -depth parameter to control how far down a directory you can search. (image) I have a large file structure to search but I only want to go two folders deep on the search.  Is there a way to do this in PowerShell? (image) Certainly!  In PowerShell 5.0, you can use the -depth parameter to specify how many branches deep ...

PowerTip: Capture the output of a Linux application in PowerShell

Summary: Use the built-in features of PowerShell to obtain data produced by a Linux application. (image) Can I run a Linux application like ls and capture its output in PowerShell? (image) You certainly can!  It’s no different from when you normally grab output from any other command in Windows.   To grab the output of the ls command, ...