Scripting Blog [archived]

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

Latest posts

Dec 25, 2016
Post comments count 0
Post likes count 0

PowerTip: Get the Notes field when accessing users or groups in Active Directory

Doctor Scripto

Summary: Use the Active Directory Module to get the information from the “Notes” field.  I’m trying to find the Active Directory property to use to access the Notes field when I’m viewing a user or a group. Could you lend me a hand? No problem at all. The property you are looking for is and can be added when you use or . I like to add as well to pull in most of the descriptive details. Here is an example:

Dec 25, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 5

Doctor Scripto

Summary: Curly Blue learns the true meaning of scripting in PowerShell. When we last saw our hero, Curly Blue, he had discovered not only the ease of use of PowerShell but also the vast community resources provided by Github. Because of this one reason alone, his co-workers, Loopy and Codestock, had no need to fret over the upcoming holiday weekend. Their task was solved in a quick and cost-effective manner. Curly sat down to reflect upon his past 24 hours of “intensive PowerShell training” with his co-workers. “At first I came in and was apprehensive about scripting. I personally didn’t find it useful due to...

Dec 24, 2016
Post comments count 0
Post likes count 0

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

Doctor Scripto

Summary: Use the cmdlets provided in PowerShell 5.1 to manage local user accounts on a system. 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? Yes.  In the most recent version of Windows 10 / Windows Server 2016 with PowerShell 5.1, you can run just one cmdlet to pull up a list of local users.

Dec 24, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 4

Doctor Scripto

Summary: Curly Blue learns how to use GitHub resources on PowerShell to clean out old office installations. When we last saw our hero, Curly Blue, he had been hanging around the office of Azura and discovering the simple ways he could use Windows PowerShell with minimal learning. In the past few days, he’s seen how easy it is to work and access files by date and time, use features that are built into the Active Directory Administrative Center (ADAC) to identify samples of PowerShell, and pull data by using the Common Information Model (CIM) cmdlets. He was blinking in disbelief. Although he was a master of usi...

Dec 23, 2016
Post comments count 0
Post likes count 0

PowerTip: Use PowerShell to determine active CIM sessions

Doctor Scripto

Summary: Use the Common Information Model (CIM) cmdlets to pull a list of active sessions to remote workstations. How can I find active CIM sessions on my workstation? Just use this one cmdlet to list all active CIM sessions, and you’re done for the day!

Dec 23, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 3

Doctor Scripto

Summary: Curly Blue discovers the raw power of Cim-Instance combined with PowerShell remoting. We continue with Curly Blue as he searches understand the meaning of scripting. He is still sitting in the office with Azura. The co-op student, Hermie, has run off to chase something that wandered into his phone. Virus or virtual creature, nobody can ever tell. A new request has just made its way across her desk. The CIO would like a complete inventory of all serial numbers of the company’s workstations. Curly just rolled his eyes. “Over 5,000 workstations! Just where do we even start?” Azura noted his displeasure...

Dec 22, 2016
Post comments count 0
Post likes count 0

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

Doctor Scripto

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

Dec 22, 2016
Post comments count 0
Post likes count 0

Curly Blue and the meaning of scripting – Part 2

Doctor Scripto

Summary: Curly Blue learns how to use built-in PowerShell script examples in Windows. Yesterday we met our new friends, Curly Blue and Linux. Curly had started his new job as a IT Professional at Contoso. The challenge for poor Curly was that he had never learned scripting or, for that matter, gotten into the spirit of it. He had mastered a unique talent of hyper-active data entry skills combined with keyboard shortcuts. He was now walking to the Office of Azura. She is in charge of managing the migration of the company resources to the cloud. Today she is working with a co-op student, Hermie. “Our big challe...

Dec 21, 2016
Post comments count 0
Post likes count 1

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

Doctor Scripto

Summary: Use the new -depth parameter to control how far down a directory you can search. 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? Certainly!  In PowerShell 5.0, you can use the -depth parameter to specify how many branches deep you’d like to limit from the search root. Here, we can search the C:\Users\CurlyBlue folder for DOCX files but only go to two levels below. Here is an example: