Search Windows and Linux Networking

Showing posts with label Windows Server 2012. Show all posts
Showing posts with label Windows Server 2012. Show all posts

Friday, November 15, 2013

How to Search All Disabled User In Active Directory.

How to Search all Disabled User In Active Directory and export in to the Excel File using VBScript.


OR

 How to Search all Active/Enabled User In Active Directory and export in to the Excel File using VBScript


There are some time when you needed or your manager ask to provide all Disabled user Or currently all Active User from Active Directory in excel file and there are more than 100 Accounts in your Active Directory and you have to give all information in limited time frame. then best option is to use VbScript that search all disabled or All Active/Enabled users in Active Directory.

Following is the VBScript that Search for all Disabled Users in entire domain.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 Option Explicit
Dim objRootDSE,strDNSDomain,adoConnection,strQuery,adoRecordset,Field
Dim CN,FirstName,LastName,initials,Descrip,EmailAddr
Dim strFileName, ObjExcel, intRow

'Search all Disabled users in Active Directory and export them in to Excel file.


wscript.echo "Searching all disabled users in Active Directory please wait...."

'Open Excel file to Write the Data

Set ObjExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.WorkBooks.Add()
intRow = 1
       ObjExcel.Cells(intRow,1).Value = "CN"
       ObjExcel.Cells(intRow,2).Value = "FirstName"
       ObjExcel.Cells(intRow,3).Value = "initials"
       ObjExcel.Cells(intRow,4).Value = "LastName"
       ObjExcel.Cells(intRow,5).Value = "EmailAddr "

' Bind to Domain or OU

Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADSDSOObject"
adoConnection.Open "ADs Provider"
strQuery = "<LDAP://" & strDNSDomain & ">;(&(objectCategory=person)(objectClass=user));adspath;subtree"

'Define condition for search
Set adoRecordset = adoConnection.Execute(strQuery)

' Loop to search users through them...


Do While Not adoRecordset.EOF
     Set Field = GetObject(adoRecordset.Fields(0).Value)
     If Field.accountDisabled = TRUE Then
       'wscript.echo "Account " & Field.displayname & " is disabled"
       intRow = intRow + 1
       Cn = Field.CN
       FirstName = Field.GivenName
       LastName = Field.sn
       initials = Field.initials
       Descrip = Field.description
       EmailAddr = Field.mail

       'Wscript.echo "Users full Name is " & FirstName & " " & initials & " " & LastName & " and his Email ID is " & EmailAddr

       ' Write to Excel File
       ObjExcel.Cells(intRow,1).Value = CN
       ObjExcel.Cells(intRow,2).Value = FirstName
       ObjExcel.Cells(intRow,3).Value = initials
       ObjExcel.Cells(intRow,4).Value = LastName
       ObjExcel.Cells(intRow,5).Value = EmailAddr
     
      End If
 
adoRecordset.MoveNext

Loop
'If completed notify as it done.
wscript.echo "Done"

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





You can also use this script to search all Active/Enabled user in entire domain by just modifying condition Field.accountDisabled = TRUE with Field.accountDisabled = FALSE

OR

You can also use this script to find all Active/Disalbed users by just modifying Bind base string (strQuery ) using Organization Unit. For example

strQuery = "<LDAP://OU=DisabledAccounts,DC=Example,DC=com>;(&(objectCategory=person)(objectClass=user));adspath;subtree"

I hope this will help you. :-)

Thursday, October 24, 2013

How to disabled IPv6 on Windows 2008 Server from registry

Step to permanently disabled IPv6 from Windows 2008 Server or windows 7.


If you do not required IPv6 on your windows 2008 Server system or windows 7 Desktop you can disabled it from registry.



To disabled IPv6 support go to:-

login in to the server/Desktop with user member of Administrator group and follow the step

 Start> run > and type regedit. Expand the path

Coputer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIV6\Parameters

Now Right Click the folder Parameters and Select New > DWORD(32-Bit) Value > Name the key as DisabledComponents
Now open the DisabledCompontents key and type ffffffff and click ok.<8 time " f " with lower case >

Final setting look like this:-



Now close the all application and restart your server/Desktop.


After reboot check IPv6 disappear from command result ipconfig /all

Monday, May 20, 2013

Installing & Configuring Active Directory on Windows Server 2012 Step By step


To install Active Directory on Windows Server 2012 we will need Static IP to system, DNS & FQDN for Domain.

Adding the Active Directory Domain Services Role

Log on to server with local administrator account & open Server Manager.
From the Server Manager window click on “Add roles and features”. 
Then “Before you begin screen” will open, click Next. 


Select “Role-based or feature-based installation” in the “Installation Type” screen below & click Next.

You will then see below screen from which you can select a destination server.  Windows server 2012 is having this new feature using which you can deploy roles and features to remote servers or to an offline virtual hard disk.  We are selecting the current server from the server pool. Select the server & click Next.


Then on Add Roles And Features Wizard select the “Active Directory Domain Services” and “DNS Server”



Then you will be prompted to add the features needed by Active Directory Domain Services (ADDS). Click “Add Features”.



Then on below screen select “DNS Server” & click Next.


Then on below screen you can select additional feature if you want & click Next.
(Group Policy Management feature will be automatically installed during the domain promotion).


Then on “Active Directory Domain Services” page below you will see some basic information about ADDS & DNS. Click Next.


Then on next page you will be able to see summary of the roles & features selected for installation. Click Install.


It will start installation process & upon completion will show installation succeeded message. Click Close.


Promoting Server To A Domain Controller

After installing AD DS roles & features you will be able to see AD DS in the left pane in Server Manager window with warning message stating “Configuration required for Active Directory Domain Services” Click on More.


Then All Server Task Details And Notifications window will open. Click on “Promote this server to a domain controller” under Action.


Then AD DS configuration wizard will open.
Select “Add a new forest” as this is the first domain controller.  Enter Root domain name & click Next.


On below screen specify Forest Functional Level & Domain Functional Level also provide Directory Services Restore Mode password. Click Next.


You will get warning regarding DNS delegation, which can be ignored. Click OK & then Next.


On next window, NetBIOS name will be automatically assigned. Click Next.


On next window you will be able to confirm or change the path of Database, Logs & SYSVOL folders. Click Next.


Then on Review Options page, review your selections & click Next.


Then it setup will check for prerequisite. After passing through prerequisite, click on Install.


At completion of setup, system will restart. After promoting the server to domain, your local administrator becomes domain administrator. So, login to the server using domain administrator user name and password.