Showing posts with label RSAT. Show all posts
Showing posts with label RSAT. Show all posts

Wednesday, September 5, 2012

Powershell and Active Directory: Get Your Active Directory Forest and Domain Information using Powershell.

Hi,

Sometime a situation comes when you want to know about your Active Directory Infrastructure.  That what is your AD Forest Name is, how many replica server do you have in your company,how many domain sites do you have  etc. etc.

When you get Answers you want to document all the above things for your future reference. Today a situation arise that i want to know answers about the above questions.

I know i can get all the answers by using Active Directory Module. But then i think if someone else need the same information, then what he will do?,he will do the same or he ask someone else in his team and waiting for their replies.

Then i think, why not to script it, so that everyone can get benefitted from it,.

So i write a simple script to done this task. Before running the script make sure you have RSAT tools installed.

Download Link: http://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-5a51444a 

This script generates a HTML formatted Report file in your desktop folder.
That reports contain the information on :
  • Forest Name
  • Forest Mode
  • Forest Domains
  • Domain Naming Master
  • Schema Master
  • Global Catalog Servers
  • Forest Domain Sites
  • Domain Name
  • Domain NetBios Name
  • Domain Mode
  • PDC Emulator
  • InfraStructure Master
  • Replicated Servers
Screenshot of the script.
05-09-2012 15-40-18
Download Link: http://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-5a51444a 

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

Thursday, August 2, 2012

Powershell and Active Directory: Powershell based GUI Application to create Group in AD.

Hi,

GUI are for dumbs and for lazy likes me or for beginners. Few days ago a new IT guy joined our company, he is kind of fresher. I first which we gave him is to create few Groups in active directory. He is new so i don’t want him to sit on any live server or mess with “Active Directory Users and Computers Console”, for him i wrote a little bit tiny tiny powershell based GUI app.

You can download the script from here : https://dl.dropbox.com/u/17858935/Create_Groups_in_AD_Community.zip

This Script is based on Active Directory module, so before running this script make sure you have RSAT tools installed.

When you run the script first time , it ask you for Username and password, please provide your domain administrator credentials.

02-08-2012 12-06-23

After providing the credentials a GUI will open.

On the Top of the GUI i added a little bit of information about the presence of “Active Directory Module”, and if the Module found is equal to “NO” then this GUI wont work.

In Group Name : Provide the desired group name which you want to create.

In Description : Provide a little bit information about the Group.

In Group Scope: Select your desired Group Scope.

In OU: Select the OU location of The Group.

In Server: Choose your nearest domain controller.

02-08-2012 21-16-38

Your final screen will be look like below. and now click on create.

02-08-2012 21-17-05

That’s all, Our Group is created successfully.

02-08-2012 21-18-12

Download Link : https://dl.dropbox.com/u/17858935/Create_Groups_in_AD_Community.zip

Thanks

Aman Dhally

Thanks for reading.

Thanks!

Aman Dhally

Buy-More-Twitter-Followers 4fb29548b6adc linkedin

nala_what

Tuesday, July 3, 2012

Powershell and Group Policy : "Find all Group Policy Objects in a domain environment using Powershell"

 

Hi,

As you know that yesterday we install "RSAT" tools and enable the "Group Policy" module for powershell. You can refer to this link about enable Group Policy Module.

After Enabling our "Group Policy Module" our first task is to list all Group Policies. Let See which cmdlet we can use.

Lets Start.

Make sure you have RSAT Tool Installed and Enabled the Group Policy in Optional Features (http://newdelhipowershellusergroup.blogspot.in/2012/07/enable-group-policy-powershell-module.html)

Import group Policy Module

Import-Module Grouppolicy

02-07-2012 20-08-30


One our Module is loaded,


we can use Get-Gpo -All


Our today's target is simple , it is to "list  all Group Policy Objects"


run Get-Gpo -All and after that we will get all of our group policies.


03-07-2012 11-31-14


That's all for now , now we know that to list all Group Policy Objects we need to run "Get-Gpo -All" cmdlet.


Thanks!


Aman Dhally


Buy-More-Twitter-Followers   4fb29548b6adc


tom_hit

Monday, July 2, 2012

Enable Group Policy Powershell Module for Windows 7 domain client Computer.

 

Hi,

today i was planning to do few things with my "Group Policies", as usual i prefer to do it using PowerShell.

As you all know that to use Group Policy related stuff we need to import its module first. In windows 7 the group policy module in not enabled by default. We need to install it and then enable it.

The process it .

and after installing RSAT tool.

Click on start and search for "OptionalFeatures"

Click on it.

02-07-2012 19-07-13

and go to "Remote Server Administration Tools" expand it m and then expand "Feature Administration Tools" and tick on "Group Policy Management tools" and then click on "OK" 

02-07-2012 18-57-23

when it done installing, Open your Powershell Console and type : Import-Module GroupPolicy

No error for now..

02-07-2012 20-08-30 

Let see what if it imported it or not.

Get-Command -Module GroupPolicy


02-07-2012 20-09-20


All Done ,, Seem fine


Now we can start messing up with Group policies using Powershell. ;o) 


:)


 


Thanks!


Aman Dhally



Buy-More-Twitter-Followers   4fb29548b6adc

Wednesday, June 6, 2012

Powershell and Active Directory: Create a new group in Active Directory using Powershell.

 

Hi,

Yesterday one of my users asked me to create a few user group for him. Normally to create a new group i open "DSA.MSC" or "Active Directory users and computers" and create a desired group. This time i thought i would create a new group using PowerShell.

To create a new group in Active Directory make sure you have RSAT installed.

Lets Start.

 Make sure you have "RSAT" installed on you laptop.

Now Import the Active Directory module.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

..

ok, Module is imported,,

we are going to use "New-ADGroup" cmdlet.

I want a group Name to be  "Singers", i my OU "Testing", the Group category in my case is "Security" and the Group Scope is "Global". I choose a -Server parameter because my main DC in located outside of Delhi and then using -Credential we are providing domain administrator username and password becasue you need administrator privileges to create a group in Active Directory.

The command should be like below.

New-ADGroup -Path "OU=testing,DC=localdc,DC=com" -Name "Singers" -GroupCategory Security -GroupScope Global -Server "local-dc" -Credential localdomain\administrator

After run the Command it is asking for Domain Administrator Credentials. Provide them.

06-06-2012 12-07-24 

Ok. Command run successfully without errors.

06-06-2012 12-08-24 

Let's check out OU "testing" and see if this group is created there.

Bingo.. all Done :)

06-06-2012 12-08-46 

 

Thanks for reading.

Thanks

Aman Dhally

Buy-More-Twitter-Followers

spiderman_jump

Tuesday, May 15, 2012

Powershell and Active Directory: Remove domain user from domain Group using Powershell.

 

Hi,

Today my IT Manager told me to remove a domain user from a specific group. Normally i used "DSA.MSC" or we can say that "Active Directory users and Computers", then i find users, go to his user account properties and click on "Member Of" tab and delete the group which the user is not required.

We can do two things.. Either we can use Get-ADGroupMember cmdlet to find the group  all group member of a particular group,or, we can use Get-ADUser cmdlet to find a group membership of a particular user.

Lets Start.

 Make sure you have "RSAT" installed on you laptop.

Now Import the Active Directory module.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

..

ok, Module is imported,,

Let's use Get-ADUser cmdlet to find group membership of a domain user { http://newdelhipowershellusergroup.blogspot.in/2012/05/powershell-and-active-directory-find_11.html }

$((Get-ADUser Aman.Demo -Properties *).MemberOf -split (",")  | Select-String -SimpleMatch "CN=") -replace "CN=",""

Ok now we know that user "Aman.Demo" is a member of a Fax-Dubai and two others group. Our target is to remove "Aman.Demo" from "Fax-Dubai" Group.

15-05-2012 14-14-18

Let's cross-check if "Fax-Dubai" have a "Aman.Demo" as a member.

Get-ADGroupMember -Identity "Fax-Dubai" | Select-Object Name

Yes it has... Now lets remove "Aman.Demo" from the Group.

15-05-2012 14-28-24

we are Remove-ADGroupMember cmdlet to remove user from the desired Group.

Remove-ADGroupMember -Identity "Fax-Dubai" -Members "Aman.Demo"

before removing the user from the group it ask you for confirmation , type "Y". That's all.

15-05-2012 14-33-44

if you want to suppress Confirmation, you can use -Confirm:$false parameter , after it it wont ask for confirmation.

15-05-2012 14-36-44

ok. now we already removed the user from the group , let's check it now.

User "Aman.Demo" is a member of 2 user groups now previously it was 3, and you can see there is no "Fax-Dubai" exists in Members of now.

15-05-2012 14-39-14

All Sorted :)

Thanks for reading the blog.

Aman Dhally

Aman Dhally

Tuesday, May 1, 2012

Powershell and Active Directory: Find all windows 7 computers with Service Pack 1 installed using PowerShell.

 

Hi,

In Our company we have "Domain Environment" or we can say "Active Directory" is deployed.  By using "Active Directory" lots of things gets easy to manage. The main things that Powershell works great with "Active Directory". To use Active Directory related CMDLETS on your client laptopt we  need to install "RSAT" tool.

Problem: On some of our company laptop there are "Automatic Updates" are on, due to these auto updates Windows 7 Service Pack 1 is installed on those laptops, and Windows 7 SP1 is not compatible with some of our in-house developed software. So we need to identify these laptops.

Let's Start : Before doing anything make sure that "RSAT" tools are installed.

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-ADComputer cmdlet.

To view all the computer on AD we can use the below cmdlet.

Get-ADComputer -Filter *

01-05-2012 12-07-05

Lets filter it more . .. this time we want to see only those computers which have windows 7 installed.

Get-ADComputer -Filter 'OperatingSystem -eq "Windows 7 Professional"'  | select Name

Ok. now it is showing all those computers which have windows 7 installed.. let filter it more.

01-05-2012 12-09-59

As we know our main purpose is to find the "Windows 7 Computers with Service Pack 1" Installed.

Get-ADComputer -Filter '(OperatingSystem -eq "Windows 7 Professional") -and (OperatingSystemServicePack  -eq "ServicePack1")'

So finally we have the list of all windows 7 computers with SP-1 installed on them.

01-05-2012 12-43-08

Let just select Name Only.

Get-ADComputer -Filter '(OperatingSystem -eq "Windows 7 Professional") -and (OperatingSystemServicePack  -eq "Service Pack 1")' | select Name

01-05-2012 12-55-57

All sorted., Now i have the list of my all windows 7 computers which have Service Pack 1 installed on it.

Thanks

Aman Dhally