Category Archives: AD

Use Powershell for presenting all AD users to HR

 

Use this script to automate and send an email to the HR department with a HTML file of the users in the AD.

You can specify different blocks of users based on the company name (internal and external users like contractors) and users with special rights like administrators of helpdesk staff.

Schedule this powershell script on a domain controller or a management workstation.

 

Archive-User function – Clean up an user from AD and Exchange

 

(updated version as a function. Some error handling will follow later)

Powershell Function for cleaning up an AD user and exchange account. This can be used for example when a user leaves the company.

The information, files and mail from the user is placed in an archive folder on the network. After this has been done the user is cleaned from the network.

use as: .Archive-MWUser.ps1 -Mwusername  avanboerum

Powershell SID to username

 

A files properties on the network displays the owner of that file. When, for some reason, the username is not displayed correctly you see – instead of a username – the users SID. The format of a SID starts with a S and is like “S-1-5-21-1708337668-1520438667-1801674531-7723”.

This SID gives you no information about who it is. You can match this SID with an AD useraccount.

To convert the SID to a Username:

It will provide you with the corresponding username from the AD.

Albert van Boerum S-1-5-21-1708337668-1520438667-1801674531-7723

But wait, the real easy way is to use the identity parameter for get-aduser. You can use this parameter for the userneme, sid, guid, etc…

All the above give the same result.

Powershell unlock and reset AD account

 

Recently I found a nice script from Matt Schmit. This script give you the choice to reset a users password, unlock a account and has some nice error checking and a good structure.

Powershell unlock and reset AD account

Logoff disconnected users on RDS server with powershell

 

When you want to manually logoff disconnected users from a Remote Desktop server, you can first query the server for those disconnected sessions and then logoff those sessions.

Logoff disconnected users on RDS server with powershell:

Or if the list is to long you can query the disconnected sessions:

This script queries the RDS broken for sessions and displays a nice (gridview) form. In this form you can select a user to logoff.

Knipsel

Bulk import users

 

 

Recent Entries »