Usuário com melhor resposta
Após Criar Usuario VBScript

Pergunta
-
Caros,
tentei ja diversas formas mais nao consegui nenhuma solução quanto a esse problema. E para completar acabei esquecendo de fazer o backup do AD.
Rodei o script abaixo e deu tudo certo, porem, quando tento criar depois um usuario da forma padrão, não aparece todas as opções conforme descriminado abaixo:
só aparece apenas isso na criação do usuario pelo ad diretamente: Se alguem puder me dar uma luz!!!! Obrigado!Abraços!!
Após criar este usuario ou tambem os que ja foram adicionados via script, nas propriedades do usuario, dai me parece normal.
Script executado atraves de uma outra maquina:'----------------------------------------------------------------------'
'--------------------------Criação de login----------------------------'
'----------------------------------------------------------------------'Option Explicit
Dim objRootLDAP, objContainer, objUser, objShell
Dim objExcel, objSpread, intRow
Dim strUser, strOU, strSheet
Dim strCN, strSam, strFirst, strLast, strPWD, strinitials, stroffice, strmail, strtitle, strdepartment, strprincipalname, strTitulo, strMensagem, strcompany, strdescription, strtelephoneNumberstrOU = "OU=CONTAS NOVAS ,"
strSheet = "C:\scripts\User.xls"' Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://" & strOU & objRootLDAP.Get("defaultNamingContext"))' Open the Excel spreadsheet
Set objExcel = CreateObject("Excel.Application")
Set objSpread = objExcel.Workbooks.Open(strSheet)
intRow = 3 'Row 1 often contains headings' Here is the 'DO...Loop' that cycles through the cells
' Note intRow, x must correspond to the column in strSheet
Do Until objExcel.Cells(intRow,1).Value = ""
strSam = Trim(objExcel.Cells(intRow, 1).Value)
strCN = Trim(objExcel.Cells(intRow, 2).Value)
strFirst = Trim(objExcel.Cells(intRow, 3).Value)
strinitials = Trim(objExcel.Cells(intRow, 4).Value)
strLast = Trim(objExcel.Cells(intRow, 5).Value)
strPWD = Trim(objExcel.Cells(intRow, 6).Value)
stroffice = Trim(objExcel.Cells(intRow, 7).Value)
strmail = Trim(objExcel.Cells(intRow, 8).Value)
strprincipalname = strSam & "@teste.interno"
strtitle = Trim(objExcel.Cells(intRow, 9).Value)
strdepartment = Trim(objExcel.Cells(intRow, 10).Value)
strdescription = Trim(objExcel.Cells(intRow, 11).Value)
strtelephoneNumber = Trim(objExcel.Cells(intRow, 12).Value)
strcompany = "Cast Informatica S.A"' Build the actual User from data in strSheet.
Set objUser = objContainer.Create("User", "cn=" & strCN)
objUser.sAMAccountName = strSam
objUser.givenName = strFirst
objUser.initials = strinitials
objUser.sn = strLast
objUser.SetInfo
objUser.physicalDeliveryOfficeName = stroffice
objUser.mail = strmail
objUser.userPrincipalName= strprincipalname
objUser.displayName = strCN
objUser.title = strtitle
objUser.department = strdepartment
objUser.company = strcompany
objUser.description = strdescription
objUser.telephoneNumber = strtelephoneNumber' Separate section to enable account with its password
objUser.userAccountControl = 512
objUser.pwdLastSet = 0
objUser.SetPassword strPWD
objUser.SetInfointRow = intRow + 1
Loop
objExcel.QuitstrTitulo = "COMANDO CONCLUIDO!!"
strMensagem = _
"USUARIO(S) CRIADO(S) COM SUCESSO!" & vbcrlf & vbcrlf & _
" Mova para OU correta e crie a mailbox." & vbcrlf & _
"" & vbcrlf & _
""
'BtnCode = WshShell.Popup(strMensagem, 5, "Informação:", 64 + 0)
msgbox strMensagem, 0 + 64, strTitulo
WScript.Quit
Rodrigo Carvalho
Respostas
-
Rodrigo,
Você deve ter clicado no lugar errado, a primeira imagem que você postou se refere a criação de um contato (Contact), você tem que escolher User.
Fábio de Paula Junior
- Marcado como Resposta Rogodeca quarta-feira, 10 de abril de 2013 21:36
Todas as Respostas
-
Rodrigo,
Você deve ter clicado no lugar errado, a primeira imagem que você postou se refere a criação de um contato (Contact), você tem que escolher User.
Fábio de Paula Junior
- Marcado como Resposta Rogodeca quarta-feira, 10 de abril de 2013 21:36
-