Tag: PowerShell

  • Finding the full OU path of an AD OU

    Using PowerShell, I was building a script to identify a subset of the groups in a given organizational unit (OU). As you may know, these are built up of subsections with the prefixes CN (common name) and DC (Domain Component). In order to have the script run successfully, you need to specify the OU using…

  • PowerShell: Find all groups containing a specific string

    Sometimes, you need a list of all groups whose name contain a specific string, whether that is in the beginning, middle, or end of the group name. As we’ve seen previously, looking up groups in PowerShell is done with the Get-ADGroup command. Adding the -filter parameter allows us to find groups that satisfy our needs.…

  • PowerShell: Check Remote Computer Disk Capacity

    From time to time, I get tickets where one of many possible root causes may be a full disk. While accessing this information over RDP is often an option, it is rather more intrusive than needed. What’s more, I usually don’t have access to access file servers over RDP. Enter PowerShell and the get-WmiObject query!…

  • 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: 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…

  • How to run a PowerShell script

    As has been the case so many times before, this week I’m bringing you the direct result of a customer request. The customer in question needed to know how to run a .ps1 script. As you may or may not know, double-clicking the script defaults to editing the script. At any rate, here’s how you…

  • Exporting AD group members’ display name

    Five years ago, I showed you how to export a list of members of an Active Directory group, using a command line query. One issue I’ve run into using this query, is that I get their user name, not their actual name, which tends to make the resulting list hard to parse. As I had…