Showing posts with label Get-ADGroup. Show all posts
Showing posts with label Get-ADGroup. Show all posts

Monday, October 29, 2012

Script to send HTML Formatted email of Newly Created Active Directory Users and Groups using Powershell.

Hi,

Sometime i love to run scripts manually and sometime  i like to schedule them.

 In our company we have lots of new joiners every week, and we also creates and use AD groups. In our IT team not everyone known about which users has just joined the company recently.

To ensure everyone in IT team knows about a new joiner in the company i have written a Tiny-Miny powershell script which is scheduled to run on every monday.

This script send a HTML formatted email containing the list of New AD Users and New AD groups those are created within a 7 days,.

You can download the script from this link : http://gallery.technet.microsoft.com/scriptcenter/Find-Active-Directory-26b71b73

Screenshot of the Output Email:
29-10-2012 16-54-31
You can download the script from this link : http://gallery.technet.microsoft.com/scriptcenter/Find-Active-Directory-26b71b73

Thanks
Aman Dhally
join aman on facebook Join aman on Linkedin follow aman on Twitter

Tuesday, May 22, 2012

Import only specific Cmdlets from Module in Powershell.

 

Hi,

Sometime in Scripts we imported whole module but we need only we cmdlets of that module. For example i am working on a script which run on "Active Directory",  but in "Active Directory" module i am using only two cmdlets Get-ADUser,Get-ADGroup , so it seems wise if we able to import only these cmdltes rather then whole bunch of other Cmdlets which we are not going to use in the script.

we can do this using -Cmdlet parameter in Import-Module Cmdlet,

Import-Module ActiveDirectory -Cmdlet Get-ADUser,Get-ADGroup

Now we are importing only two cmdlets  Get-ADUser,Get-ADGroup from "Active Directory" Module.

22-05-2012 11-13-29

Ok, Module imported successfully now check which cmdlets "Active Directory" have { i already show you how to do this here }

Get-Command -Module ActiveDirectory

22-05-2012 11-13-40

Yo!!!, Module have has only two Cmdlets which we told him to import.

Cool!! Isn't.

Thanks for reading.

Aman Dhally

joker_nurse

Wednesday, May 2, 2012

Powershell and Active Directory: Find all distribution groups in AD with their Email-ID along with the date of creation using Powershell.

 

Hi,

Today i got task from my IT Manager to create a list of all distribution group in our AD along with there Email-Id's also he required the date of creations of those distribution groups.

I thought lets try this with PowerShell. I was planning to use Get-ADGroup cmdlet to fulfil my purpose. This cmdlet only available if you have  "RSAT" installed on you laptop.

Lets Start.

Import the Active Directory module first.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

After importing the Module, we are going to use Get-ADGroup cmdlet.

To view all the group n your Active Directory we can use below command. This will show all the Groups.

Get-ADGroup -Filter *

02-05-2012 15-06-02

Lets filter the output and choose to view only "Distribution Groups"

Get-ADGroup -Filter 'GroupCategory -eq "Distribution"'

So we have the the list of distribution Groups. but our purpose is still not resolved. now we need Mail and Date of creation of these Groups.

02-05-2012 15-11-10

To view the mail, creation date we need to add -Properties *  to the  Get-ADGroup cmdlet.

Get-ADGroup -Filter 'GroupCategory -eq "Distribution"' -Properties * | select Name,mail,whenCreated | ft -AutoSize

02-05-2012 15-25-28 

All Sorted, our purpose is fulfil. If required we can also export the out to .CSV or .TXT format.

I Hope that it helps someone.

Thanks

Aman Dhally

spiderlove02