Working with Active Directory and PowerShell (part 2) – Creating a user

To create a user in our Organizational Unit we need the following LDAP string:$LDAPStringUsers = “LDAP://OU=Demo Users, DC=contoso,DC=com” And run the following command to connect to AD:$usersOU = [ADSI] $LDAPStringUsers To create a user run this command:$newUser = $usersOU.Create(“user”,”cn=Kalle Becker “)$newUser.Put(“sAMAccountName”, “Kalle”)$newUser.SetInfo() We need a password for this user, and I actually found a command…

2

Working with Active Directory and PowerShell (part 1) - Creating an Organizational Unit

Next on the agenda for building this demo environment was to create users in Active Directory. I can honestly say that I didn’t have a clue on how to do this, so I went to http://www.live.com and found this site:http://thelazyadmin.com/blogs/thelazyadmin/archive/2007/05/14/create-an-ad-user-in-powershell.aspx I also found this site:http://powershelllive.com/blogs/lunch/archive/2007/04/05/day-7-manage-users.aspx That gave me some pointers on how to do this.Our…

0

Using PowerShell to read xml-files

A couple of months ago a colleague and I decided to try to build a demo-environment for SharePoint. We wanted to be able to take a new fresh installed Windows 2003 (or 2008) server, and just run a PowerShell script and then the environment should be up and running. The environment should of course include…

3