remove

Remove user from specific AD groups using PowerShell

If you are looking for simple AD group member removal script this article is for you. Today I want to share few examples about getting group membership and removing one specific user from multiple groups. I was using commands form ActiveDirectory module. Get user group membership Below you can find several commands which helps to get user direct group mmebership: Remove user group membership Removing user from specific group is …

group

Add users to local group remotely using PowerShell

How to add users to local group on remote servers? The easiest way for me was to create simple PowerShell script 🙂 Some time ago we posted article about adding group – link. In this article I want to show you how to add mutliple users to some specific group. Get Members First you should know how to verify who is currently added to group. To get members from remote …

Shadow Copy

PowerShell one-liner: Shadow Copy Backup date

This short article is about getting last Active Directory Shadow Copy Backup date. To check this we just have to scan event log for specific event id. AD Backup Information about Shadow Copy Backup is located in logname called ‘Directory Service’ and event id ‘1917’: “The shadow copy backup for Active Directory Domain Services was successful.” One of the command that we could use here is Get-WinEvent where we can …

Get AD System info remotely using PowerShell function

In this post you will find out how to get basic AD system information using PowerShell function. There are multiple articles on our blog describing plenty of Active Directory aspects. This time I want to show you another great function which helps discover useful data from remote systems. Get AD System Using below function you can get the following information: – Computername – DomainDNSName – DomainShortName – ForestDNSName – IsNativeMode …

PowerShell Tip of the Week: Combine multiple CSV files

Recently I had to combine multiple files and count unique users from them. Script is pretty simple but it might me useful in some troubleshooting sessions. Below you can find two examples about how can this be done. Combine CSV files I created folder called Files on my desktop and pasted there user lists in CSV format. Files contains multiple columns but I was focusing only on Samaccountname: File example …

Basic DC health email report via PowerShell

Today I would like to share one of the scripts for basic DC health checks. Some time ago I added article about DCDIAG and Repadmin. This time I created html formatted report for DCDIAG, ADSystem and AD Services. You can modify this easily and add additional functions. DC Health report Script contains lots of lines so we need to break it apart to make it more understandable. For health checks …

Find duplicated SPNs in Active Directory

Today’s script will help you to in easy way find duplicated SPNs in Active Directory. What is SPN? SPN (Service Principal Name) according to Microsoft definition is unique identifier of service instance. To better understand it we can compare it to alias (CNAME record) in DNS. A Service Principal Name is a pointer to account created in Active Directory domain. It can be either created for service account or computer …

Use Set-ADUser command to update user attributes

How to use Set-ADUser command? Updating user properties manually can be time consuming. This is why its good to have a script for bulk modifications. One of the ActiveDirectory module command is called Set-ADUser and it allows us to modify user properties. Below you can find script for adding or updating AD user mobile phone. To update phone number for one specific user we can just run the following command: …

Get restricted groups from GPO

Today I want to share you my function which will show you how to get restricted groups from GPO. In big Active Directory environments access to servers and workstations are usually managed by AD groups and group policies. Script which I prepared can help administrators to find which restricted groups have an acccess to servers/workstations in specific OU. How script works? Script is checking for all of the GPOs which …

Use PowerShell to generate token bloat report

Today you will find out how to create token bloat report and send it to specified email address. If you are working in large scale environment you may find this useful. Token bloat There is often a situation when some user is complaining that he is unable to access some corporate applications. After short investigation you can find that one of the reason for that might be large number of …