Category: PowerShell

  • PowerShell: Check computer last logon date

    In a recently closed ticket, I had specified that the solution would be automatically applied upon reboot of a computer. As so often happens one of the twenty or so users affected by the solution emailed to say that it didn’t work. Having dealt with said user before, I had a hunch that they hadn’t…

  • PowerShell: Pipe output to CSV file

    Last week, I showed you how to get specific properties for all users in a given OU. Knowing that the output of that query quickly gets hard to navigate, wanting to remove the extraneous data that the customer didn’t request, and assuming that they wanted to manipulate the data, I decided to return the results…

  • PowerShell: Getting properties for all user objects in a given OU

    Two weeks ago, I showed you how I got some specific properties for a specific user. Perhaps unsurprisingly, the next request from my customer was a similar dump from a specific OU. While the Identity parameter works well when you’re dealing with a specific user, it doesn’t help when you want all users. Furthermore, they…

  • Powershell: Retrieving all properties for a given user object

    I was asked to provide an overview of all available properties in an Active Directory user object for an upcoming project. As it turns out, that is very easily accomplished. Unsurprisingly, PowerShell has an applet for this. We use the Get-ADUser applet, with the parameters Identity to identify the user in question and Properties with…

  • PowerShell: Look up all direct reports

    In the Organisation tab of a user object in Active Directory, you have the option to set who is the manager of a given user. While this may seem unnecessary, I have found it very useful when supporting a customer where I don’t know the reporting lines, as it gives me a one-stop place to…

  • PowerShell: Count enabled user accounts

    A few weeks ago, I showed you how to get a list of all enabled user accounts in PowerShell. Perhaps unsurprisingly, after having presented this to my customer, it transpired that what they really wanted, was to know how many enabled user accounts existed in Active Directory. Once more, my Google-fu put me on the…

  • PowerShell: Find all users in a specific OU

    One of my customers asked for an overview of the UPNs of all users in a specific OU. Having become fairly familiar with the Get-ADUser command, I decided to see if I couldn’t make it do this, too. I knew that I would need to filter the results of the command on OU, and found…

  • PowerShell: Find all enabled user accounts

    Some time ago, I was asked to provide a list of all enabled user accounts in Active Directory. My thoughts immediately went to PowerShell, assuming that there would be tools available to achieve that task. I knew that the Get-ADUser query, combined with a parameter, would likely be the ticket. Using the -ldapfilter parameter to…

  • PowerShell: Building a script to find all members of several given groups

    Last week, I showed you how I find all the nested members of a specified group. When we get requests for such audits, however, they usually specify doing so for a number of groups. Now, we could of course do it, one group at a time, adding information to our output as we go, however…

  • Building a script to find all members of a given group

    Some time ago, I was asked to provide a list of everyone with access to a specific system. After communicating with the client, it transpired that they were particularly interested in knowing who were the members of a set of Active Directory groups. While this can be done manually, I wanted to try my hand…

  • Exporting a list of a given users group memberships from Active Directory

    A while back, I showed you how to export a list of all members of a group, as well as all computers, from Active Directory. On a related note, here’s how to export all group memberships held by a single user: Log on to your Domain Controller Open a command prompt Enter the command dsget…