Click here to Skip to main content
15,912,578 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: TcpClient timeout delay Pin
Member 1263260118-Sep-16 19:19
Member 1263260118-Sep-16 19:19 
GeneralRe: TcpClient timeout delay Pin
Gerry Schmitz18-Sep-16 20:50
mveGerry Schmitz18-Sep-16 20:50 
GeneralRe: TcpClient timeout delay Pin
Member 1263260118-Sep-16 20:58
Member 1263260118-Sep-16 20:58 
GeneralRe: TcpClient timeout delay Pin
Gerry Schmitz18-Sep-16 21:22
mveGerry Schmitz18-Sep-16 21:22 
GeneralRe: TcpClient timeout delay Pin
Member 1263260118-Sep-16 21:53
Member 1263260118-Sep-16 21:53 
GeneralRe: TcpClient timeout delay Pin
Gerry Schmitz18-Sep-16 22:22
mveGerry Schmitz18-Sep-16 22:22 
GeneralRe: TcpClient timeout delay Pin
Member 1263260118-Sep-16 22:35
Member 1263260118-Sep-16 22:35 
GeneralMessage Closed Pin
9-Sep-16 6:16
Member 127301999-Sep-16 6:16 
GeneralRe: test Pin
Nathan Minier9-Sep-16 6:27
professionalNathan Minier9-Sep-16 6:27 
GeneralRe: test Pin
NotPolitcallyCorrect9-Sep-16 7:47
NotPolitcallyCorrect9-Sep-16 7:47 
QuestionMicrosoft.VisualBasic.FileIO.TextFieldParser Pin
#realJSOP9-Sep-16 5:51
professional#realJSOP9-Sep-16 5:51 
AnswerRe: Microsoft.VisualBasic.FileIO.TextFieldParser Pin
Richard Deeming9-Sep-16 6:49
mveRichard Deeming9-Sep-16 6:49 
GeneralRe: Microsoft.VisualBasic.FileIO.TextFieldParser Pin
#realJSOP9-Sep-16 7:28
professional#realJSOP9-Sep-16 7:28 
AnswerRe: Microsoft.VisualBasic.FileIO.TextFieldParser Pin
Richard MacCutchan9-Sep-16 21:40
mveRichard MacCutchan9-Sep-16 21:40 
QuestionAssembly. Pin
Member 111616259-Sep-16 2:00
Member 111616259-Sep-16 2:00 
AnswerRe: Assembly. Pin
Pete O'Hanlon9-Sep-16 2:17
mvePete O'Hanlon9-Sep-16 2:17 
QuestionActive Directory : User account options, Homefolder drive and directory and memberof group Pin
JANAZA7-Sep-16 20:29
professionalJANAZA7-Sep-16 20:29 
AnswerRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
Dave Kreskowiak8-Sep-16 6:25
mveDave Kreskowiak8-Sep-16 6:25 
GeneralRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
JANAZA8-Sep-16 9:31
professionalJANAZA8-Sep-16 9:31 
AnswerRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
Richard Deeming8-Sep-16 10:24
mveRichard Deeming8-Sep-16 10:24 
GeneralRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
JANAZA9-Sep-16 1:30
professionalJANAZA9-Sep-16 1:30 
GeneralRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
JANAZA9-Sep-16 2:56
professionalJANAZA9-Sep-16 2:56 
GeneralRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
Richard Deeming9-Sep-16 3:02
mveRichard Deeming9-Sep-16 3:02 
GeneralRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
JANAZA9-Sep-16 3:17
professionalJANAZA9-Sep-16 3:17 
With my first piece of code that I submitted I did create everything about the user except for the ability to also create the Homepath dir/drive, account options pass exp/cannot change and setting the user's group.

I was hoping this would still be valid with the already successes and enhanced my whole process.
this is the code from you with slight changes:
VB.NET
Using user As New UserPrincipal(oPrincipalContext, UserName, Password, True) ' Last parameter is "enabled"
                    user.DisplayName = DisplayName
                    user.GivenName = FirstName
                    user.MiddleName = MiddleInitial
                    user.Surname = LastName
                    user.EmailAddress = Email
                    user.Description = Description

                    user.HomeDrive = HomeDrive
                    user.HomeDirectory = HomeDirectory
                    user.ScriptPath = ScriptPath

                    If UserPrincipalName <> "" Then
                        user.UserPrincipalName = UserPrincipalName
                    Else
                        'Added this
                        user.UserPrincipalName = UserName
                    End If

                    user.PasswordNeverExpires = True
                    user.UserCannotChangePassword = True
                     'Added this
                    user.Enabled = True

                    ' Some properties are not exposed:
                    Dim myDirectoryEntry As DirectoryEntry = TryCast(user.GetUnderlyingObject(), DirectoryEntry)
                    If myDirectoryEntry IsNot Nothing Then
                        Utility.SetProperty(myDirectoryEntry, "PostalAddress", PostalAddress)
                        Utility.SetProperty(myDirectoryEntry, "StreetAddress", MailingAddress)
                        Utility.SetProperty(myDirectoryEntry, "HomePostalAddress", ResidentialAddress)
                        Utility.SetProperty(myDirectoryEntry, "Title", Title)
                        Utility.SetProperty(myDirectoryEntry, "HomePhone", HomePhone)
                        Utility.SetProperty(myDirectoryEntry, "TelephoneNumber", OfficePhone)
                        Utility.SetProperty(myDirectoryEntry, "Mobile", Mobile)
                        Utility.SetProperty(myDirectoryEntry, "FacsimileTelephoneNumber", Fax)
                        Utility.SetProperty(myDirectoryEntry, "Url", Url)
                    End If

                    user.Save()

                    ' Add the user to the specified group:
                    Using group As GroupPrincipal = GroupPrincipal.FindByIdentity(oPrincipalContext, IdentityType.Name, MemberOF)
                        If group IsNot Nothing Then
                            group.Members.Add(user)
                            group.Save()

                        End If
                    End Using

Thanks for the fast repsonse
GeneralRe: Active Directory : User account options, Homefolder drive and directory and memberof group Pin
Richard Deeming9-Sep-16 3:23
mveRichard Deeming9-Sep-16 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.