Background: Every year there will be a lot student information changes, new student creation. It is almost impossible to do it mannually. Here is the scripts to do multiple user editing automaitically.

Information: studentDetails.csv including details of student in such format

StudentID,YearLevel,GroupID,FirstName,LastName,City,PostCode,State,StreeAddress,Country

Here is the PowerShell Script to do the job.


# Title:edit user details through PowerShell
# Author:Lei Liu
# Published at:www.itlei.com.au
# Date:25/07/2013

$userlist = import-csv studDetails.csv -header StudentID,YearLevel,GroupID,FirstName,LastName,City,PostCode,State,StreeAddress
foreach ($Person in $UserList) { $username = $Person.StudentID $LN=$Person.LastName.Trimstart("").Trimend("") $FN=$Person.FirstName.Trimstart("").Trimend("") $City=$Person.City
$PostCode=$Person.PostCode
$State=$Person.State
$StreeAddress=$Person.StreeAddress

$Description="Year "+ $Person.Yearlevel.Trimstart("").Trimend("")+" Student "+$Person.GroupID.Trimstart("").Trimend("")+" 2013" echo $LN echo $FN echo $username $user = Get-ADUser $username -Properties GivenName,SurName,State,City,PostalCode,StreetAddress,Country,Description,DisplayName $user.GivenName=$FN $user.SurName=$LN $user.State= $State
$user.City=$City $user.PostalCode=$PostCode $user.StreetAddress=$StreeAddress $user.Country="AU" $user.Description=$Description $user.DisplayName=$LN +" "+$FN Set-ADUser -instance $user }

About Lei

I am an IT specialist with over 10 year experience - years on Automation, on-Premise or Azure.

I am happy to develop however never want be a full time developer. Only do what I have to do. If it has to be PowerShell,HTML, PHP, CSS, C#, VBS or JS, front end or backend, so be it, doesn't matter!

Spent years with Windows, SCCM, SharePoint, SQL and Exchange servers. For last several years, I have been actively working under On Premise > Azure environment.

THERE IS NO WAY BACK!!!

Current Certificates:
    Microsoft® Certified-
  • -Enterprise Administrator
  • -Database Administrator
  • -SharePoint Administrator
  • -Administering and Deploying SCCM 2012
Red Hat Certified Technician
ITIL V3 Foundation - Practitioner

Working on Azure Certificates now and hopefully they can stop upgrading their questions one day! GIVE ME A BREAK!

Contact Lei

Name *
Email *
Comments *

Traffic since 10/08/2016

Today13
Yesterday83
This week637
This month1933
Total416293

Visitor Info

  • IP: 54.221.73.186
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

1
Online

2017-12-17

Login