Windows Server 2008 R2: Script create multi users with Windows Powershell

Dear All,
I have windows server 2008 R2 Active Directory Domain Service. I want to create multi users by using Windows PowerShell.
Could you guide?
BR,
Khemarin Set
[email protected]

Dear Awinish,
Your link very my solution. but i'm very basic with Powershell and I never have experience with it.
This is the link original script that you are provide:
function Select-FileDialog 
param([string]$Title,[string]$Directory,[string]$Filter="CSV Files (*.csv)|*.csv")
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$objForm = New-Object System.Windows.Forms.OpenFileDialog
$objForm.InitialDirectory = $Directory
$objForm.Filter = $Filter
$objForm.Title = $Title
$objForm.ShowHelp = $true
$Show = $objForm.ShowDialog()
If ($Show -eq "OK")
Return $objForm.FileName
Else
Exit
$FileName = Select-FileDialog -Title "Import an CSV file" -Directory "C:"
$ExchangeUsersOU = "OU=ExchangeUsers" # I don understand, I have all users are store in all-users ou
$domain = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$DomainDN = (([System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()).Domains | ? {$_.Name -eq $domain}).GetDirectoryEntry().distinguishedName
$final = "LDAP://$DomainDN"
$DomainPath = [ADSI]"$final"
$cOU = $DomainPath.Create("OrganizationalUnit",$ExchangeUsersOU)
$cOU.SetInfo()
$UserInformation = Import-Csv $FileName
$OUPath = "LDAP://$ExchangeUsersOU,$DomainDN" # I don understand
$UserPath = [ADSI]"$OUPath"
Write-Host "---------------------------------------------------------------"
Write-Host "Creating LAB Users"
Write-Host ""
Write-Host "---------------------------------------------------------------"
Foreach ($User in $UserInformation){
$CN = $User.samAccountName
$SN = $User.Surname
$Given = $User.givenName
$samAccountName = $User.samAccountName
$Display = $User.DisplayName
$LABUser = $UserPath.Create("User","CN=$CN")
Write-Host "Creating User: $User.samAccountName"
$LABUser.Put("samAccountName",$samAccountName)
$LABUser.Put("sn",$SN)
$LABUser.Put("givenName",$Given)
$LABUser.Put("displayName",$Display)
$LABUser.Put("mail","$samAccountName@$domain")
$LABUser.Put("description", "Lab User - created via Script")
$LABUser.Put("userPrincipalName","$samAccountName@$domain")
$LABUser.SetInfo()
$Pwrd = $User.Password
$LABUser.psbase.invoke("setPassword",$Pwrd)
$LABUser.psbase.invokeSet("AccountDisabled",$False)
$LABUser.psbase.CommitChanges()
Write-Host "Script Completed"
If posible, could you help to correct script as: I have domain name: hello.net. All user are store in all-users ou.
BR,
Khemarin Set
[email protected]

Similar Messages

  • How to up Windows Server 2008 R2 SP1 created VM with Windows 8.1 hyper-v manager

    Hi
    I have VM that created with Windows Server
    2008 R2 SP1. This was up without a problem with the windows 8 hyper-v manager. I have recently upgraded my OS with 8.1. Now I have tried to import this VM but it
    throwme following message.
    This is a real pain when there is no way of doing this. Any help greatly appreciated.
    Regards
    Radika

    Hi,
    Brian is right, for mange the Server 2008r2 sp1 we recommend use the Windows 7 or 7.1 platform.
    More information:
    Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)
    http://www.microsoft.com/en-us/download/details.aspx?id=7887
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Windows Server 2008 R2 display "Network drives disconnect" with a red X

    I wrote a script for using Group Policy to achieve a function where navigate to "Comupter Configuration"--"Windows Settings"--"Scripts (Startup/Shutdown)"--"Startup", then i put the script what is
    for "network mapping" things into "Scripts", then i restart the target machines for updating policy, but it showed that there is a "red X" even though i can open this network path. how could the "red X" disappear?

    Hi,
    Thanks for your feedback.
    Based on your description, I am not sure if it is due to the script. Maybe you can ask in the
    MSDN forum to make sure that the script is correct.
    In addition, I also suggest creating the mapped driver via Group Policy Preferences. For more detailed information, please refer to the links below:
    Drive Maps Extension
    Using Group Policy
    Preferences to Map Drives Based on Group Membership
    Best regards,
    Susie

  • To install Remote Desktop Services User CAL on Windows Server 2008 R2 Enterprise Edition with SP1

    Dear Sir,
    Presently we have installed Windows Server 2008 R2 Enterprise Edition with SP 1. And now i would like to install Remote Desktop Services User CAL on this server. I have 25 digit product key of Windows Server
    2008 R2 Remote Desktop Services User CAL (20). Downloaded this product key from our MSDN Subscriptions.
    Kindly suggest me how to install (CAL server with product key that i have) and configure remote desktop services on my above existing server also how to point other server with my CAL server.
    Thanks

    Hi,
    1. Install Remote Desktop Session Host and Remote Desktop Licensing Role Services using Server Manager.
    2. Open RD Licensing Manager (licmgr.exe), Activate your server, then install your license
    3. In RD Session Host Configuration (tsconfig.msc), set the Licensing mode to Per User and Specify your RD Licensing server name (itself).  If you want you may configure these two settings via group policy setting instead.  The path of the
    group policy settings is Computer Configuration\ Administrative Templates\ Windows Components\ Remote Desktop Services\ Remote Desktop Session Host\ Licensing
    4. You may point other RDSH servers to your RD Licensing server using RD Session Host Configuration or via group policy as mentioned above.
    5. Optionally you may consider installing other Remote Desktop Role Services such as RD Gateway, RD Web Access, RD Connection Broker, etc.
    -TP

  • Adobe Acrobat 9.41 Pro+ on Snow Leopard 10.6.5 + Network users (Windows server 2008) = CRASH!

    Adobe Acrobat 9.41 Pro will work “great” on the admin account, however through the active directory log on of network users, every user gets the long crash report upon opening the application.
    Permissions are set so “everyone” can gain access, however the crash issue is not a decent setting on the Mac environment.
    Will welcome any thoughts..comments… and suggestions.
    Thank you-

    OS: Snow Leopard 10.6.5
    Active Directory Setup: Windows Server 2008 - Log in for network users
    Adobe Acrobat: version crash 9.3 and 9.4.1
    Admin of the Mac computer can log in and use the Adobe Acrobat Professional software, however when a network user
    Tries to log on the computer and open the Adobe Acrobat 9.3 or 9.4 the software hangs....for 7-8 seconds then displays a crash report, and options are send to apple.
    Permissions on every Adobe Acrobat folder on the computer are set to read/write for every user of the program.
    Software Type: Using the DVD purchase with the Education program, and the serial number does accept, and download the software from the Adobe web page.
    Emma McFaul

  • Script to uninstall a program on all stations in a domain with a DC Windows Server 2008 R2

    Hello
    I need to uninstall a software (in this case is Microsoft Security Essential) on 130 computers in a domain where the DC is Windows server 2008 R2. The domain computers are running Windows XP (most of them), Windows 7 and Windows 8.
    Can somebody tell me how to do that? I'm not very happy to manually uninstall MSE on all that 130 computers.
    I never used scripts and I don't know how to make one.
    Thank Tou

    Here is a good article on how to remotely uninstall software:
    http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/14/use-powershell-to-find-and-uninstall-software.aspx
    ¯\_(ツ)_/¯

  • You cannot shadow a session with multiple monitors enabled in Windows Server 2008 R2

    Searching through the forums (and according to KB2484290) it appears that there is no solution to this problem.  We are rolling out thin clients that are using dual monitors exclusively and we were very surprised to find out that we couldn't shadow
    sessions with dual monitors (which to us means that we can't shadow ANY sessions).  This now completely changes our approach to managing these devices. 
    We are running Windows Server 2008 R2 SP1 with Remote Desktop Services installed.  The thin clients are running Windows Embedded Standard 7 with the latest updates / RDP client. All steps have been followed to ensure that the apropriate settings and
    permissions have been set up to allow access into the session. 
    We tested by unchecking the RDP setting “use all my monitors for the remote session”, with that setting disabled shadowing worked
    Questions:
    1. KB2484290 is from Dec 2010 - It's now April 2012, is there a workaround / hotfix for this issue that will allow us to shadow sessions using the native Microsoft tools?
    2. Are there any recommended alternatives (software)?  Free/Paid - doesn't matter we just need something that will work.  I'm sure there are a few options out there but I am looking for suggestions for what people have used in the past that worked
    best for them to help us narrow down the choices.

    Hi,
    In my experience, so far, the workaround is Remote Assistance, Remote Assistance supports multiple monitors, and is the presently recommended solution if you need this functionality. Remote Assistance is a Windows Server Feature that must be explicitly installed
    on Windows Server 2008 R2; it is already installed with the client versions of the operating system.
    More information:
    Remote Assistance Overview
    http://technet.microsoft.com/en-us/library/cc753881.aspx
    Remote Assistance and Resulting Internet Communication in Windows Server 2008
    http://technet.microsoft.com/en-us/library/cc770456(v=ws.10).aspx
    As far as I know, there are some third-party tools can be used as the solution, such as Teamviewer, ISL Online, etc.
    Please Note: The third-party products discussed here are manufactured by companies that are independent of Microsoft. We make no warranty, implied or otherwise, regarding
    these products' performance or reliability.
    Regards,
    Dollar Wang
    Forum Support
    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback
    here.
    Technology changes life……

  • Enabling Windows Server 2008 R2 Built-In Administrator Account

    The properties box for my Windows Server 2008 R2 built-in administrator program says the account is disabled.  Even the primary user account has virtually no priveliges.  How can I, with a mere primary user account available at logon, enable
    the built-in administrator account, or otherwise grant my primary user account administrator priveliges?  Windows Server 2008 R2 denies my primary user account access/permission for nearly all changes to accounts, programs and OS features. 
    Stephen W Plunkett

    The properties box for my Windows Server 2008 R2 built-in administrator program says the account is disabled.  Even the primary user account has virtually no priveliges.  How can I, with a mere primary user account available at logon,
    enable the built-in administrator account, or otherwise grant my primary user account administrator priveliges?  Windows Server 2008 R2 denies my primary user account access/permission for nearly all changes to accounts, programs and OS features. 
    Stephen W Plunkett
    In some of the organisations, default admin accounts on member servers are purposefully locked/disabled through group policy for security reasons.
    If you know the password for locked out/disabled admin account then there is a possibility of unlocking/re-enabling the account without using any third party tools.
    To do that,
    Restart the server
    Press F8 and select Safe Mode Without
    Networking
    Log on to the server with locked out/disabled admin account with its password.
    If you could successfully log on to the server then you will have option to unlock and enable the built-in admin account !
    Most of the downtime's are caused because of SysAdmin's curiosity ! - Santosh

  • How to merge partitions in Windows Server 2008 quickly and effectively?

    How to merge partitions in Windows Server 2008 quickly and effectively?

    Hi,
    In Windows systems we can only extend a partition to unallocated space behind it - so if we have 2 consistent partitions, we can only delete the second one and extend the first one.
    If the 2 partitions are on 2 different disks, you can also create a spanned volume - you will still need to delete the second partition and convert both disks to dynamic disk to create the spanned volume. 
    If you have any feedback on our support, please send to [email protected]

  • Windows Server 2008 R2 - access from Anywhere

    Dear All,
    We have small business network in our institutions. Our network infrastructure is follows as,
    Windows Server 2008 R2 with Domain Controller - Roles installed are ADDS, File Service, WDM, DNS, DHCP
    Fully Qualified Domain Name : XXXXXX.local
    Client System: Windows 7 Ultimate 32 bit systems 30 Numbers.
    Internet Connection: 1 Mbps download speed and 420 Kbps Upload speed from Airtel.
    Router: TP-Link ADSL Router.
    So far we have used our server within our premises, the router acted as a gateway and supplied internet service for server and client system. Now we want to access the server from outside of our network from i.e. domain users logon from anywhere from the
    world. What are the requirements for this kind of setup and steps to implement this setup.
    Thanks and Regards S.R. Karthick System Engineer

    Hi,
    Firstly, it is not recommended to install the DHCP role on a DC.
    In addition, you can use the DirectAccess feature in Windows server 2008 R2 so that the clients
    running Windows 7 Ultimate
    can securely connect to the corporate network from any location without any type of traditional VPN. For more detailed information, please refer to the link below:
    DirectAccess for Windows
    Server 2008 R2
    Best regards,
    Susie

  • How to install SQL server 2008 express on Windows server 2008 R2 standard OS

    Hi,
    I have Windows server 2008 R2 Standard edition (64-bit) and trying to install SQL server 2008 express edition since I do not have SQL server 2008. When I install it I am unable to see Management Studio so I am trying to install management studio as well
    but still I am facing issue. Please let me know whether SQL server 2008 express edition is compatible with  Windows server 2008 R2 Standard. If not then pls let me know the proper steps to install it.
    Regds

    Hello,
    Service Pack 1 for SQL Server 2008 is required to be compatible with Windows Server 2008 R2.
    Please download QL Server 2008 Express with SP1 included from the following link:
    http://www.microsoft.com/en-us/download/details.aspx?id=25052
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Unable to install Directory Sync tool in windows server 2008 R2 Eneterprise

    Hi,
    I am unable to install Directory Sync  in windows server 2008 R2 Eneterprise.i have joined my machine domain joined computer running Windows Server 2008 r2 enterprise,when i click dirsync.exe then gives below Error.
    The Windows Azure Active Directory Sync tool must be installed on a domain joined computer running Windows Server 2008 Service Pack 2 or later,or Windows Server 2008 r2 Service Pack 1 or later
    Please help on this why this happing when i try to installed DirSync software.
    Regards
    Anil Kumar

    Hi,
    have you already installed .net framwork 3.5 and 4.5.1 on that machine?
    http://technet.microsoft.com/en-us/library/jj151831.aspx
    Also make sure that you run the install command from an elevated command prompt.
    Hope that helps,
    Lutz

  • Windows Server 2008 R2 and Windows 7 DNS Problem

    Hi,
    I have a DNS Server hosted in Windows Server 2008 R2 and our clients are using Windows 7. All are working fine then suddenly there are times that our client cannot access our internal site and cannot connect with our IM which is also hosted in the server.
    Tried to ping the server's IP but got this result: 
    Ping request could not find host .com. Please check the name and
     try again.
    NSLookup works fine. Tried to use the ip address instead of the domain name and it works. Resetting network connection seems to resolve the issue but we cannot do it all the time especially when we have hundreds of computers in our office. Anyone have ideas
    regarding this?

    Hi,
    “Resetting network connection seems to resolve the issue but we cannot do it all the time especially when we have hundreds of computers in our office. Anyone have ideas regarding
    this?”
    It seems is the client IP address conflict, it may cause by your DHCP Conflict Detection Attempts value setup is not appropriate. You can try to set Conflict Detection Attempts
    to a value other than 0.
    More information:
    Detect and Avoid IP Address Conflicts
    http://technet.microsoft.com/en-us/magazine/ff606371.aspx
    Hope this helps
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • What is the most powerful books for Windows server 2008 and R2?

    Hi,
    There are many books out there that cover Windows server 2k8 and its R2 successor but i wonder which ones to focus on. In the same time, all books are for one purpose, "Windows Server 2008". Each author has his/her own view on the platform. I don't
    want to read them all just to avoid confusions and complications.
    These are the list of books that i have along with books that i finished reading them:
    Exam 70-640 Configuring Windows Server® 2008 Active Directory® (Finished this)
    Exam 70-642 Configuring Windows Server 2008 Network Infrastructure (Finished this)
    Exam 70-643 Configuring Windows Server 2008 Application Infrastructure
    (Finished this)
    Exam 70-646 Windows_Server__2008_Server_Administrator_Second_Edition (Finished this)
    Mastering_Windows_Server_2008_R2 (Finished this)
    McGraw.Hill.Microsoft.Windows.Server.2008.Administration.Feb.2008
    McGraw.Hill.Microsoft.Windows.Server.2008.The.Complete.Reference.Feb.2008
    OReilly.Windows.Server.2008.The.Definitive.Guide.Mar.2008
    Sams.Teach.Yourself.Windows.Server.2008.in.24.Hours.May.2008
    Sybex.MCTS.Windows.Server.2008.Active.Directory.Configuration.Study.Guide
    Windows Server 2008 Active Directory Resource Kit (Finished this)
    Windows Server 2008 Networking and Network Access Protection (Finished this)
    Windows Server 2008 Unleashed
    Windows Server 2008 R2 Unleashed
    Do you think the unfinished books worth reading?
    Appreciate your help.

    Thank you for the reply. My goal is to read everything (ins and outs) about Win 2008 and R2 platforms before i jump into Win 2012. I have pretty good experience in certain roles in Win 2008 such ADDS and ADCS. As clarified, i've finished a good number of
    books but i want to make sure that i didn't miss a single piece of information that maybe covered in another book.
    Honestly, i find the Technet docs are informative but daunting. On the other hand, books written by authors are more friendly because authors can throw jokes while explaining a certain technology, which makes the reader more attracted to the topic. In addition,
    examples, practices, labbing, and quizzes in the books are more fun.

  • IE is not showing on windows server 2008 after updates

    Hi,
    I have installed Window server 2008 R2.
    After installing i found IE 8 on the server, but after 1day it automatically updated some softwares and now IE is not showing on my system.
    i.e IE uninstalled after the updates to the windows server.
    Please can some one help me to get the IE. I tried installing IE8, IE9 after downloading but it is showing "Internet Explorer 8 is not supported on this operating system"
    Regards
    Krishna

    Hi,
    Internet Explorer 8 runs on any of the following operating systems: 
    Windows Vista, 32-bit versions      
    Windows Vista, 64-bit versions      
    Windows Vista with Service Pack 1 (SP 1) or a later version      
    Windows XP, 32-bit versions with Service Pack 2 (SP2) or a later version      
    Windows XP Professional, 64-bit Edition      
    Windows Server 2003, 32-bit versions with Service Pack 2 (SP2) or a later version      
    Windows Server 2003, 64-bit versions with Service Pack 2 (SP2) or a later version      
    Windows Server 2008, 32-bit, or a later version      
    Windows Server 2008, 64-bit, or a later version 
    Please expand the below path to check whether IE is there:
    C:\Program Files\Internet Explorer
    Regards,
    Yan Li
    Regards, Yan Li

Maybe you are looking for