Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Create new windows user via a Web service

Create new windows user via a Web service

Scheduled Pinned Locked Moved XML / XSL
questionhelpdatabasehardware
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BLOEDHOND
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • B BLOEDHOND

      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

      B Offline
      B Offline
      BLOEDHOND
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups