PowerShell for Windows Admins:

Active Directory


March 29, 2017  1:29 PM

Name mismatch

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, CIM, Powershell

Ever wondered why you can’t do this:

Get-ADComputer -Filter * -SearchBase 'OU=Servers,DC=Manticore,DC=org' |
Get-CimInstance -ClassName Win32_OperatingSystem
The –ComputerName parameter on get-CimInstance accepts pipeline input BUT its by property name.
PS> Get-Help...

March 4, 2017  5:59 AM

Modifying AD users in bulk

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

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 in the last post so lets see how we use it.

$users = Import-Csv -Path...


March 3, 2017  1:52 PM

Test data for bulk AD changes

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

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 – but some accounts didn’t have an employee number. First you need...


February 16, 2017  2:24 PM

Get-ADUser doesn’t display all properties

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

Microsoft’s Active Directory cmdlets have some issues. One of the ones that catches everyone when they start using them is that Get-ADUser doesn’t display all properties. A default call to Get-ADUser displays a subset of the available properties of the user object:

DistinguishedName :...


December 14, 2016  5:38 AM

Active Directory Schema Versions

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

With the release of Windows Server 2016 its time to update my schema versions script

$sch = [System.DirectoryServices.ActiveDirectory.ActiveDirectorySchema]::GetCurrentSchema()
$de = $sch.GetDirectoryEntry()
switch ($de.ObjectVersion) {
    13{"{0,25} " -f "Schema Version...


November 18, 2016  5:14 AM

Changing the samAccountName

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

I was recently asked how the samAccountName – also referred to as the login id – could be changed. First lets look at an account: PS C:\Scripts> Get-ADUser -Identity 'FredFox' DistinguishedName : CN=FOX...


November 17, 2016  8:18 AM

Creating test accounts in Active Directory

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

There’s often a need to create test accounts in AD. You may want to create a a set of test accounts or if you have a demo/test lab you may need accounts in that. Creating the names for the accounts is a pain unless you go down the test1, test2 etc route. One way to real looking names is I use...


November 5, 2016  10:59 AM

Creating a new AD forest

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell, Windows Server 2016

As I’ve completely rebuilt my demo/lab machine I need to re-create the Active Directory This is now so simple even on a server core machine First install the roles and features needed Add-WindowsFeature -Name AD-Domain-Services, RSAT-AD-PowerShell, DNS, RSAT-DNS-Server, DHCP,...


July 18, 2016  4:49 AM

Manning Deal of the Day 19 July 2016

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Books

Deal of the Day July 19: Half off my book Learn Active Directory Management in a Month of Lunches. Use code dotd071916au at http://bit.ly/2a8jroO For more information on Manning’s Deal of the Day see -  


February 24, 2016  1:14 PM

Get-ADUser quirk

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Active Directory, Powershell

Came across an interesting quirk of the way Get-ADUser works. If you use the –Identity parameter and tell it to find a specific user PS> Get-ADUser -Identity dontexist Get-ADUser : Cannot find an object with identity: 'dontexist' under: 'DC=Manticore,DC=org'. At line:1 char:1 +...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: