Ads 468x60px

Wednesday, 4 February 2015

Bulk User creation in Active Directory

Bulk user creation is a big task and can be difficult to update manually all the required records/attributes in active directory if it is a business requirement.
Today we will learn, how to make this work in one shot with good accuracy

Powershell:

There are many ways to make this work, but we will learn this through Powershell script and CSVDE command line.
Scenario 1:- Requirement to Create bulk users under Test OU with Description, Department, Manager, First/Last Name attributes updated and password set.
Create a Excel file with the required details as shown in the below figure and save it in CSV format.
-Copy the below commands in notepad and save it as scipt.ps1 format. Both the files should be located in C drive.

$pass = "Password123"
$password = ConvertTo-SecureString "MyPassword123" -AsPlainText -Force $pass
Import-Csv "C:\testUsers.csv" | ForEach-Object {
$userPrincinpal = $_.samAccountName + @domain.com
New-ADUser -Name $_.Name -SamAccountName $_.samAccountName
-UserPrincipalName $userPrincinpal
-Path "OU=OUTest,DC=DOmain,DV=Com"
-Description $_.Description
-Manager $_.Manager
-givenname $_.FirstN
-surname $_.LastN
-ChangePasswordAtLogon $true
-Enabled $true
Add-ADGroupMember "Domain Admins" $_.samAccountName
}

Note:Import-Module Active directory and set-execution Policy unrestricted before you run the script.

The above command will help you to update the mentioned attributes; if the requirement is different in your scenario then you can find the exact attributes with the help of below cmdlets.
"Get-help New-ADUser –examples"
This will list out the string values with Examples.

Once you run the above command it will start creating user accounts and there you finish the task through powershell .
  
CSVDE:
Scenario 2:-  We will create few users here with the help of CSVDE command.

CSVDE (Comma Separated Value Directory Exchange) is a command line utility, were we can export or import the user objects in Active directory.
Before we start with the activity, its best practice to go through with all the parameters/Syntax of CSVDE for your better understandings, when you use CSVDE –i -f sheet.csv to import the user account, ensure that LDAP fields mentioned in sheet are appropriate.

Here are the provided attributes in excel which describe as below,
  • Objectclass – Defines the type of object
  • GivenName – Defines First Name of user
  • SN – Surname
  • Description – Brief information about the object creation
  • DN – Distinguished Name
-          Save the file name in CVS format and run the below command
-          Csvde –I –f c:\sheet.csv
s   
-I used to import mode. If not specified, the default is export.
-f helps to import or export file name

After you run the command, you can easily see the results in Active Directory. If the results are not populating then please refresh the container and you will find the objects created.

Hope this information is helpful, please leave your comments below if any concerns and will get back to you.

Monday, 2 February 2015

How to Create FTP User Isolation site (IIS) in windows 2008 R2

FTP user isolation is a good way to protect your data from unnecessary access and provides control over sharing and security. FTP user isolation will help security over FTP authentication and FTP authorization. We have different version of IIS running with all favors of window release and it’s all about running websites.

In windows 2008 R2 we have IIS version 7 released, even we have IIS 7.5 release in windows 7, IIS 8 release in windows 8 and IIS 8.5 release in Windows 8.1.

Through FTP share, We can isolate the access by providing access to limited user or group of users both domain users and workgroup user.

To install FTP site, we should have mandatory Web server (IIS) Roles which includes FTP server’s role also.



 Create a New Folder in desired location, where you like to keep the shared data.


Open Internet Information Services (IIS) Manager console.


Expand your domain, R.click on sites and select ADD FTP share
Name the FTP site and browse to the FTP directory which you have created early.



Next you need to configure Bindings. Bindings are basically what IP address you like to assign or FTP should communicate through website and choose No SSL unless we use certificates.



Setup for authentication and authorization, for authentication you can choose Basic or Anonymous and for authorization you can choose either All users, Anonymous users or specific users.

But this scenario we will learn to assign the FTP access to individual user.


Lastly, click on Finish.

Now, we will see if the FTP share has started working with specified user access.
You can now access the FTP site from any client machine in the domain using the user credentials,

Open computer explorer and type as below to access FTP share.
ftp://ftp-server-IP-address/ FTPshareName/


Finally you will be successfully login to FTP share and save you data over the network in FTP server environment.