header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
New USers created are disabled?
Last Post 30 Mar 2010 06:36 AM by James. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
JamesUser is Offline
Basic Member
Basic Member
Posts:398
Avatar

--
08 Feb 2010 06:21 AM
    Hello,

    I have the following code which works fine does everything is supposed to however it disables the user.

    Can anyone explain why?



    #Add-PSSnapin Quest.ActiveRoles.ADManagement
    #Read in the CSV file           
    Import-Csv -Path "C:\ftp.csv" |         
        ForEach-Object {                     
                    $FirstName = $_.FName
                    #$LastName = $_.SName
                    $DisplayName = $_.ActualDisplayName
                    $Password = $_.Password
               
                    $School = $_.School
               
                    $PrincipalName = $_."E-Mail"
               
                    $Name = $_.Alias
                    $Alias = $_.Alias
                    $OU = "stockport.sch.uk/schools/" + $School + "/Users" 
               
            $secureString = ConvertTo-SecureString $Password -AsPlainText –Force            
               
                    # create new users            
               
            Write-host "Creating User..."
    #-Title "student" -LastName $LastName to be added in when creating students
            New-QADUser  -FirstName $FirstName -SamAccountName $Alias -Email $PrincipalName -Name $Name -DisplayName $DisplayName -OrganizationalUnit $OU -UserPrincipalName $PrincipalName
          
            Set-User -Identity $Alias -DomainController "schdc2" -ResetPasswordOnNextLogon $true
         }



    Many Thanks

    James
    Karl MitschkeUser is Offline
    Basic Member
    Basic Member
    Posts:457
    Avatar

    --
    10 Feb 2010 06:49 AM
    James;

    It's a feature :)

    Really, it is - your user has no password set, so it's not enabled. See http://groups.google.com/group/micr...d7a911d7c4

    Karl
    http://unlockpowershell.wordpress.com
    Co-Author, Windows PowerShell 2.0 Bible
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:398
    Avatar

    --
    30 Mar 2010 06:36 AM
    Thanks for that,

    I have just found the script again I was using and added - UserPassword $Password and it seems fine.

    Thanks for that

    James
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer