Count Objects in AD OUs – Powershell

A recent request we had was to count the number of objects in each OU in AD, so we could identify which ones were not being used any more. To achieve this we used a PowerShell script, and exported to a csv file.

(more…)

Read More

Count Number of AD Users – PowerShell

Very quick piece of PowerShell that will count the number of AD Users in your domain

We can then extend this to only count the Enabled AD users

This is all well and good but we want to dive deeper and search on multiple OUs.

(more…)

Read More

Export Subnets from Active Directory Sites and Services

As part of an AD upgrade project we have recently been working on, need to discover what existing AD sites were deployed, and whether these needed to be deployed in the new AD environment.

This can be quickly achieved using some simple PowerShell commands

(more…)

Read More

Active Directory Users Created In Last 30 Days – PowerShell

As part of an Active Directory project we have been involved with, there had been a compliance issue where the Service Desk were creating users with “Password Never Expires”, which was against the security policy of the company.

To help identify the incorrectly created Users and also to fix them, this script was created;

(more…)

Read More

Create Active Directory Test Users – PowerShell

A quick and simple PowerShell script that can be adjusted for your own lab environment that will create (in this example 1000) test users in Active Directory

(more…)

Read More

Active Directory Dormant User Report – PowerShell

Working on a recent large multi site Active Directory environment, we were asked to come up with a PowerShell script that will help the AD Team identify dormant user accounts in their AD domain.

Firstly, we had to establish what a dormant user was, and it was agreed that this would be a User account that has not logged in for 60 days. Then we needed to find out of there were any exceptions to this policy, such as maternity or sick (we didnt want to report on this accounts). Finally, we wanted to exclude any Service accounts or Resource accounts, so we had to get the DN of these as well.

(more…)

Read More

Enable Non-Owner Mailbox Access Auditting – Exchange Online

One of the Office 365 Security recommendations is to enable auditing for non-owner mailbox access in Exchange Online. This should then be reviewed on a scheduled basis, i.e. weekly, to make sure other people are not snooping on mailboxes.

Let’s walk through how you can do this in Powershell for ALL mailboxes in your Exchange Online subscription

(more…)

Read More

Adding VMs To Existing Azure Environment Through Powershell

I have often just built a some demo labs containing one or two VMs and then you want to add an additional VM to the same Resource Group, vNet, Subnet etc etc and still have the same naming conventions for all the components. I kind of found that bit difficult through the Azure portal, some component like a NIC or PIP would get a generated name or wouldnt follow the naming convention I had wanted.
So here we are with a little Powershell script that should help make it much easier.
(more…)

Read More