Cannot sign in with ADDS users created with powershell
hey guys, didn't knew post i'm posting here, tell me if i'm wrong. i've created users powershell on active directory, using windows 8.1 2008 r2 server, problem cannot log in accounts i've created, there solution changing in network account's policies, need code portable, thoughts ? create users parameters:
$props=@{
name=$username
accountexpirationdate='4/10/2016'
changepasswordatlogon=$true
accountpassword=$accountpassword
credential='administrator'
enabled=$true
homedirectory="p:\dossierspersonnels\$username"
homedrive='p:'
homepage='http://google.ch'
manager='administrator'
title='user'
pobox='25662'
profilepath="c:\users\$username"
samaccountname=$username
}
this error when try log in 1 of account:
the sign-in method you're trying use isn't allowed
run @ prompt until can figure out system doing. don't use ise or form until understand how works.
function adduser{ param( $pren, $name, $accountpassword ) $username ="$pren $name" $samname='{0}{1}' -f $pren.substring(0,1), $name $domain=(get-addomain).dnsroot.tolower() $upn='{0}@{1}' -f $samname,$domain $props=@{ name=$username samaccountname=$samname userprincipalname=$upn displayname=$username accountexpirationdate='4/10/2016' changepasswordatlogon=$true accountpassword=(convertto-securestring -string $accountpassword -asplaintext -force) enabled=$true homedirectory="p:\dossierspersonnels\$username" homedrive='p:' homepage='http://google.ch' manager='administrator' title='user' pobox='25662' } try{
new-aduser @props -ea stop
$upn
}
catch{write-host "$_" -fore red -back white} } if($u=adduser -name smith -pren john -accountpassword 'paszw@rd'){ #'user created successfully'
get-aduser -filter "userprincipalname -eq '$u'"
}else{ 'failed create user' }
pay close attention errors
i removed "profilepath" cannot set that way.
¯\_(ツ)_/¯
Windows Server > Windows PowerShell
Comments
Post a Comment