Category Archives: Powershell Basics

Modifying AD users in bulk

Modifying AD users in bulk involves either setting one or more properties to the same value for a set of users or reading in the values you need from a data source of some kind. We prepared some test data … Continue reading

Posted in PowerShell and Active Directory, Powershell Basics | Leave a comment

Test data for bulk AD changes

I’ve had a number of questions about changing AD user data in bulk. If you need to do that you need some test data. The specific questions were around setting the Division property and the EmployeeNumber at the same time … Continue reading

Posted in PowerShell and Active Directory, Powershell Basics | Leave a comment

Get-Content and Numbers

A common technique is to put a list of information into a text file and read that using Get-Content. The information is often server names. This works great when the data is strings but breaks down if you’re dealing with … Continue reading

Posted in Powershell Basics | Leave a comment

Filtering of Objects and Properties

Saw a post on the forum today that suggests people are still confused about how to perform filtering of objects and properties in PowerShell. As with so much in PowerShell explanations are always better with examples. Let’s start with the … Continue reading

Posted in Powershell Basics | Leave a comment

Append data to a file

A question on the forums – the user wanted to append data to a file. This is a common scenario when you’re creating a log file. There’s 2 easy ways to do this. Lets create a couple of variables with … Continue reading

Posted in Powershell Basics | Leave a comment

Preserving property order

This is a very common pattern: $os = Get-CimInstance -ClassName Win32_OperatingSystem $comp = Get-CimInstance -ClassName Win32_ComputerSystem $props = @{   OS = $os.Caption   InstallDate = $os.InstallDate   LastBoot = $os.LastBootUpTime   Make = $comp.Manufacturer   Model = $comp.Model } … Continue reading

Posted in Powershell Basics | 3 Comments

Calculating Standard Deviation – the class

You’ve seen how to calculate standard deviation and how to turn that calculation into a PowerShell function. This time we’ll use the calculation to create a class: class stats {     static [double] StandardDeviation ([double[]]$numbers) {     $mean = … Continue reading

Posted in Powershell Basics | Leave a comment