Category Archives: PowerShell and Active Directory

Moving FSMO roles in PowerShell v6.1.1

With the Windows Server 2019 media now being available again it’s time to move my test lab over to the new version. I’d built a Windows Server 2019 VM and installed PowerShell v6.1.1. I discovered that in Server 2019 and … Continue reading

Posted in PowerShell and Active Directory, PowerShell v6 | 2 Comments

Active Directory cmdlets in PowerShell v6.1.1

Just discovered that you can run the Active Directory cmdlets in PowerShell v6.1.1 BUT there is a huge caveat. The Windows 10 October 2018 (Windows 10 1809) update includes the RSAT tools (including the AD tools) as optional features. This … Continue reading

Posted in PowerShell and Active Directory, PowerShell v6 | 1 Comment

Windows Compatibility Pack

As reported last month the Windows Compatibility Pack for .NET core is available. This adds back some of the functionality missing from .NET core. This functionality is ONLY of relevance on Windows machines. A PowerShell module based on the Compatibility … Continue reading

Posted in PowerShell and Active Directory, PowerShell v6 | Leave a comment

Get an AD user’s manager

Interesting question on the forum about finding the manager for a given user in AD – assuming the Manager field is populated of course. If you’ve not worked with the AD cmdlets this is a good introduction to some of … Continue reading

Posted in PowerShell and Active Directory | 1 Comment

Comparing AD group membership on EmployeeId

Back in this post – http://itknowledgeexchange.techtarget.com/powershell/comparing-group-membership/ I showed how to compare the membership of two groups using Compare-Object. The comparison was based on the samAccountName. A question raised the issue of comparing AD group membership on EmployeeId In the case … Continue reading

Posted in PowerShell and Active Directory | 1 Comment

Get-ADUser filtering

Saw a question on the forums that revolved around Get-ADUser filtering. Initial code was like this Import-Csv .\users.txt | foreach {   Get-ADUser -Filter {Name -like $_.Name} } which on the face of it seems reasonable. However, you get errors like … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

Are your domain controllers real?

A question on the forum asked about discovering if domain controllers are physical or virtual machines. This will do the job foreach ($domain in (Get-ADForest).domains) {   Get-ADDomainController -filter * -server $domain |   sort hostname  |   foreach { … Continue reading

Posted in PowerShell and Active Directory, PowerShell and CIM | Leave a comment