Tag: Active Directory

The following function is a work in progress, but I thought I would go ahead and share it.
This function requires a module named PowerShellAccessControl that was created by Rohn Edwards which is downloadable from the TechNet Script Repository. The version 3.0 beta revision of his module which is also downloadable on that same page is what was used to test the examples shown in this blog article.

You're looking for a user in your Active Directory environment who goes by the nickname of "JW". You know that's the user's initials and you need to find their AD user account.
Typically you'd use the Identity parameter, but that parameter doesn't allow wildcards:

PowerShell

1

Get-ADUser-Identityj*w*

Verifying wildcard's are not allowed on the Identity parameter of Get-ADUser:

While at Microsoft TechEd last week, I met a gentleman from Europe who was experiencing a particular issue with the Get-ADUser PowerShell cmdlet.
When Get-ADUser is used with a hard coded value such as name as shown in the following example, it returns the expected information without issue:

PowerShell

1

Get-ADUser-Filter{Name-eq'Administrator'}

The issue is that when the name, for example, is stored in a variable and double quotes are used to try to expand the variable, nothing is returned:

Did you know that it's super easy to run a function that exists only on your local computer against a remote computer even when no remoting capabilities have been added to the function itself? It does however require that PowerShell remoting be enabled on the remote system, but if you're running Windows Server 2012 or higher, PowerShell remoting is enabled by default on those operating systems.
I'll start off by creating a function that performs a meaningful task so I can use it to demonstrate Read more [...]

Each domain has a PDC emulator FSMO role so how do I determine which domain controller holds the PDC emulator FSMO role in the forest root domain if I have multiple domains in my forest? Sounds like you can't see the forest root for the trees :-).
The answer of course is with PowerShell:

PDC Emulator in Forest Root Domain

PowerShell

1

2

3

4

Get-ADForest|

Select-Object-ExpandPropertyRootDomain|

Get-ADDomain|

Select-Object-PropertyPDCEmulator

The Active Directory PowerShell module which is part of the Remote Server Administration Tools (RSAT) is installed on the workstation these commands are being run from. Read more [...]

A request has been received to grant additional permissions to an existing user in your organizations Active Directory environment. The username of this existing user is "frank0". In additional to his current responsibilities, Frank will be taking on the responsibilities of Alan who goes by the username of "alan0".
Note: The examples shown in this blog article are being performed on a Windows 8.1 machine that has the remote server administration tools installed. The Active Directory module is Read more [...]

Notice that in Active Directory Users and Computers (ADUC) when setting the expiration of a user account, there's only a way to have the account expire at the end of a specific day:
The same option exists in the Active Directory Administrative Center (ADAC):
In ADAC, you can see the PowerShell command that the GUI uses to accomplish this task:
Let's query that particular property with PowerShell to see exactly what it's now set to:

I recently received a request to determine why a specific user account was constantly being locked out after changing their Active Directory password and while I've previously written scripts to accomplish this same type of task, I decided to write an updated script.
Active Directory user account lockouts are replicated to the PDC emulator in the domain through emergency replication and while I could have used the Get-ADDomain cmdlet to easily determine the PDC emulator for the domain:

As I'm sure you're aware, there's no setting where you can simply flip a switch to lock out Active Directory user accounts. So what is one to do if you need some locked out accounts to do testing with?
This script is something I whipped up to accomplish just that because I'm working on another blog where I need some locked out Active Directory user accounts to work with. This script requires the RSAT tools to be installed on the workstation that it is being run from, specifically the Active Directory Read more [...]

I saw a tweet yesterday from Chris Duck about a PowerShell version 4.0 bug:
Here's a link to the Connect Bug on this particular issue.
The issue occurs when you try to use the Get-ADUser or Get-ADComputer cmdlets along with specifying the Properties parameter with the asterisk "*" wildcard character to select all of the properties.
No issue when the client is running Windows 8.1 with the RSAT tools installed and the Active Directory domain controllers are running Windows Server 2012 Read more [...]

Last week I posted a PowerShell function to determine what Active Directory domain controllers held the FSMO roles for one or more domains and forests. That particular function used the Get-ADDomain and Get-ADForest cmdlets which are part of the Active Directory PowerShell module. As it so happens, a friend of mine, Shay Levy who is a PowerShell MVP posted an article on PowerShell Magazine that uses a couple of one liners that use the .NET Framework to return the FSMO role holders.
I'm not Read more [...]

A while back, I had a need to figure out with PowerShell what server in an Active Directory domain held the PDC Emulator FSMO Role. I found a script on a very popular blog site that figured it out by using a command similar to this:

PowerShell

1

2

3

Get-ADDomainController-Filter*|

whereOperationMasterRoles-containsPDCEmulator|

selectName

While it accomplished what was necessary, I immediately thought "I can do better" and improved the one liner so it filtered left:

Recently, I decided to add a second domain controller to my mikefrobbins.com domain. The existing server and this new server that will become a domain controller both run the Microsoft Windows Server 2012 operating system and both were installed with the default installation type of server core (no GUI).
Even though the GUI can be turned on and off in Windows Server 2012 (unlike in Windows Server 2008 and 2008 R2), I prefer not to add the GUI unless absolutely necessary.
You've already loaded Read more [...]

This past Saturday, I presented a session at PowerShell Saturday 003 in Atlanta. Towards the end of the presentation, I created 290 Active Directory user accounts by using the information for employees contained in the Adventure Works 2012 database. This is actually a PowerShell script that I whipped up Friday night at the hotel after the speaker dinner. I populated some demographic information by joining multiple tables together from that particular database. There is more demographic information Read more [...]

You have a fresh installation of Windows Server 2012 that was installed using the default installation type of server core installation (no-GUI). This server will be the first domain controller in a brand new Active Directory forest.
Log into the server and launch PowerShell by typing "powershell.exe". You'll need to first add the AD-Domain-Services role to the server:

PowerShell

1

Add-WindowsFeatureAD-Domain-Services

The installation of this role completes and a restart is not required:
Now to make Read more [...]

You have an Active Directory user account and you want to make a second user a member of the same groups without removing the second user from any groups they may already be a member of.
I prefer using the Quest PowerShell Cmdlets for Active Directory for doing my AD administration work. They have been downloaded and installed on the system this is being run from. The Quest snap-in has been added to make the cmdlets available.
User 'afuller' is a member of several groups in this active directory Read more [...]

My Speaking Engagements

User Groups

Disclaimer

All data and information provided on this site is for informational purposes only. Mike F Robbins (mikefrobbins.com) makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.