Create new windows user via a Web service
-
Hi All I have created a web service that receive data from an embedded device and dumps the data in a SQL2005 database. I need now to read this data base and when a new user is added he or she must gets access to the reporting service of SQL2005. I was thinking of writing a web method that will create the user as required. But I get a access denied error, which I understand, now the question How do I side step this problem?:confused:
Progress is a process , so value it
-
Hi All I have created a web service that receive data from an embedded device and dumps the data in a SQL2005 database. I need now to read this data base and when a new user is added he or she must gets access to the reporting service of SQL2005. I was thinking of writing a web method that will create the user as required. But I get a access denied error, which I understand, now the question How do I side step this problem?:confused:
Progress is a process , so value it
Sorry here is the code _ Public Function Create_users_on_server(ByVal login As String, ByVal User_password As String, ByVal password As Integer) Dim x As VariantType Dim dirEntry As DirectoryEntry dirEntry = New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim entries As DirectoryEntries = dirEntry.Children If password = (PassWordFactor * System.DateTime.Now.Day) Then ' Set login name and full name. Dim newUser As DirectoryEntry = entries.Add(login, "User") newUser.Properties("Description").Add(login) ' User must change password at next logon (1 - true, 0 - false) newUser.Properties("PasswordExpired").Add(0) ' Password never expires. 'newUser.Properties("PasswordAge").Add(0) ' Set flags - User Cannot change password | Password never expires. newUser.Properties("Userflags").Add(&H40 Or &H10000) ' Set the password. Dim result As Object = newUser.Invoke("SetPassword", User_password) x = newUser.Path newUser.CommitChanges() ' Add user to the group "Members" Dim grp As DirectoryEntry = dirEntry.Children.Find("Members", "group") If (Not grp Is Nothing) Then grp.Invoke("Add", New Object() {newUser.Path.ToString()}) End If End If End Function
Progress is a process , so value it