473,480 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create SID?

Hi!

To create a new Windows account I use this code:

const int UF_PASSWD_CANT_CHANGE = 0x0040;
const int UF_DONT_EXPIRE_PASSWD = 0x10000;
DirectoryEntry obDirEntry = new DirectoryEntry("WinNT://" + domain);
DirectoryEntries entries = obDirEntry.Children;
DirectoryEntry obUser = entries.Add(username, "User");
obUser.Properties["FullName"].Add(name);
obUser.Properties["UserFlags"].Add(UF_PASSWD_CANT_CHANGE |
UF_DONT_EXPIRE_PASSWD);
if(homedir.Length>0)
obUser.Properties["HomeDirectory"].Add(homedir);
object obRet = obUser.Invoke("SetPassword", password);
obUser.CommitChanges();

My question is, is it possible to create a new windows account with a
certain SID?
In the case I wan't to replicate a user on another server.

Regards
Anders Aleborg
Aleborg Solutions
Jan 19 '06 #1
4 6112
Anders,

I would think that if you create the user on the domain, then the user
will be recognized across the domain.

Also, having the same SID for a user in two different domains doesn't
get you anything.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<an****@aleborg.se> wrote in message
news:1A**********************************@microsof t.com...
Hi!

To create a new Windows account I use this code:

const int UF_PASSWD_CANT_CHANGE = 0x0040;
const int UF_DONT_EXPIRE_PASSWD = 0x10000;
DirectoryEntry obDirEntry = new DirectoryEntry("WinNT://" + domain);
DirectoryEntries entries = obDirEntry.Children;
DirectoryEntry obUser = entries.Add(username, "User");
obUser.Properties["FullName"].Add(name);
obUser.Properties["UserFlags"].Add(UF_PASSWD_CANT_CHANGE |
UF_DONT_EXPIRE_PASSWD);
if(homedir.Length>0)
obUser.Properties["HomeDirectory"].Add(homedir);
object obRet = obUser.Invoke("SetPassword", password);
obUser.CommitChanges();

My question is, is it possible to create a new windows account with a
certain SID?
In the case I wan't to replicate a user on another server.

Regards
Anders Aleborg
Aleborg Solutions

Jan 19 '06 #2

<an****@aleborg.se> wrote in message
news:1A**********************************@microsof t.com...
| Hi!
|
| To create a new Windows account I use this code:
|
| const int UF_PASSWD_CANT_CHANGE = 0x0040;
| const int UF_DONT_EXPIRE_PASSWD = 0x10000;
| DirectoryEntry obDirEntry = new DirectoryEntry("WinNT://" + domain);
| DirectoryEntries entries = obDirEntry.Children;
| DirectoryEntry obUser = entries.Add(username, "User");
| obUser.Properties["FullName"].Add(name);
| obUser.Properties["UserFlags"].Add(UF_PASSWD_CANT_CHANGE |
| UF_DONT_EXPIRE_PASSWD);
| if(homedir.Length>0)
| obUser.Properties["HomeDirectory"].Add(homedir);
| object obRet = obUser.Invoke("SetPassword", password);
| obUser.CommitChanges();
|
| My question is, is it possible to create a new windows account with a
| certain SID?
| In the case I wan't to replicate a user on another server.
|
| Regards
| Anders Aleborg
| Aleborg Solutions

Not sure what you are trying to achieve, but if you need to clone user
accounts, you first have to clone the machine SID.

Willy.
Jan 19 '06 #3
Hi!

This is how I am thinking, the accounts I'm creating is for anonymous access
to websites and ftp accounts, these type of accounts I try to exclude from
the domain and create them on each server instead, one of the reasons is that
it's so many accounts(we're talking thousands of accounts).
The reason I wan't to recreate the account along with the SID is IF we for
some reason wan't to move all users to another server, we can just take the
harddrive with the files for the website and move it, recreate all users and
all permissions on files and folders will continue to work. Permissions are
tied to SID, not to the accounts name.

The other way to do this is to save all permissions in a database (we save
username and passwords for all accounts in a database already, that's why we
easy can restore the users), the problem is that this way of doing it is time
consuming, we need to loop all users that has permissions on a file and if it
matches the current username save it to a DB or XML file (we havn't found out
a way to get the permissions without looping).
Regards
Anders Aleborg
Aleborg Solutions
"Nicholas Paldino [.NET/C# MVP]" wrote:
Anders,

I would think that if you create the user on the domain, then the user
will be recognized across the domain.

Also, having the same SID for a user in two different domains doesn't
get you anything.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<an****@aleborg.se> wrote in message
news:1A**********************************@microsof t.com...
Hi!

To create a new Windows account I use this code:

const int UF_PASSWD_CANT_CHANGE = 0x0040;
const int UF_DONT_EXPIRE_PASSWD = 0x10000;
DirectoryEntry obDirEntry = new DirectoryEntry("WinNT://" + domain);
DirectoryEntries entries = obDirEntry.Children;
DirectoryEntry obUser = entries.Add(username, "User");
obUser.Properties["FullName"].Add(name);
obUser.Properties["UserFlags"].Add(UF_PASSWD_CANT_CHANGE |
UF_DONT_EXPIRE_PASSWD);
if(homedir.Length>0)
obUser.Properties["HomeDirectory"].Add(homedir);
object obRet = obUser.Invoke("SetPassword", password);
obUser.CommitChanges();

My question is, is it possible to create a new windows account with a
certain SID?
In the case I wan't to replicate a user on another server.

Regards
Anders Aleborg
Aleborg Solutions


Jan 19 '06 #4
Simple answer; use the right tools for the job. Norton ghost, Power Quest
Image drive are a few tools that are designed to do exactly this.
Willy.

<an****@aleborg.se> wrote in message
news:AA**********************************@microsof t.com...
| Hi!
|
| This is how I am thinking, the accounts I'm creating is for anonymous
access
| to websites and ftp accounts, these type of accounts I try to exclude from
| the domain and create them on each server instead, one of the reasons is
that
| it's so many accounts(we're talking thousands of accounts).
| The reason I wan't to recreate the account along with the SID is IF we for
| some reason wan't to move all users to another server, we can just take
the
| harddrive with the files for the website and move it, recreate all users
and
| all permissions on files and folders will continue to work. Permissions
are
| tied to SID, not to the accounts name.
|
| The other way to do this is to save all permissions in a database (we save
| username and passwords for all accounts in a database already, that's why
we
| easy can restore the users), the problem is that this way of doing it is
time
| consuming, we need to loop all users that has permissions on a file and if
it
| matches the current username save it to a DB or XML file (we havn't found
out
| a way to get the permissions without looping).
|
|
| Regards
| Anders Aleborg
| Aleborg Solutions
|
|
| "Nicholas Paldino [.NET/C# MVP]" wrote:
|
| > Anders,
| >
| > I would think that if you create the user on the domain, then the
user
| > will be recognized across the domain.
| >
| > Also, having the same SID for a user in two different domains
doesn't
| > get you anything.
| >
| > Hope this helps.
| >
| > --
| > - Nicholas Paldino [.NET/C# MVP]
| > - mv*@spam.guard.caspershouse.com
| >
| > <an****@aleborg.se> wrote in message
| > news:1A**********************************@microsof t.com...
| > > Hi!
| > >
| > > To create a new Windows account I use this code:
| > >
| > > const int UF_PASSWD_CANT_CHANGE = 0x0040;
| > > const int UF_DONT_EXPIRE_PASSWD = 0x10000;
| > > DirectoryEntry obDirEntry = new DirectoryEntry("WinNT://" + domain);
| > > DirectoryEntries entries = obDirEntry.Children;
| > > DirectoryEntry obUser = entries.Add(username, "User");
| > > obUser.Properties["FullName"].Add(name);
| > > obUser.Properties["UserFlags"].Add(UF_PASSWD_CANT_CHANGE |
| > > UF_DONT_EXPIRE_PASSWD);
| > > if(homedir.Length>0)
| > > obUser.Properties["HomeDirectory"].Add(homedir);
| > > object obRet = obUser.Invoke("SetPassword", password);
| > > obUser.CommitChanges();
| > >
| > > My question is, is it possible to create a new windows account with a
| > > certain SID?
| > > In the case I wan't to replicate a user on another server.
| > >
| > > Regards
| > > Anders Aleborg
| > > Aleborg Solutions
| >
| >
| >
Jan 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
8818
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
4
4380
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
10
8768
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung...
9
8245
by: Peter | last post by:
Hello£¬everyone, My program will collect a testing machine's data ,save the data and deal with the data everyday. I want to use vb.net to create database, add and delete tables or modify the...
37
3241
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
18
2680
by: Steven Bethard | last post by:
I've updated the PEP based on a number of comments on comp.lang.python. The most updated versions are still at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
5
4851
by: Michael | last post by:
Hello, I've created an ASP web page where users in our organization can create Active Directory computer accounts. The web page is running on a Server 2003 SP1 IIS 6 installation. The...
8
20326
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
2
22549
by: masri999 | last post by:
I have a requirement in SQL 2005 in Development database 1. Schema dbo owns all objects (tables,views,SPs,UDFs etc) . 2. Only DBA's ( who are database owners ) can create, alter tables ....
4
3725
by: JohnnyDeep | last post by:
I am trying to create a store proc that contain a create index with the cluster option and I receive DB21034E The command was processed as an SQL statement because it was not a valid Command...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7032
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4767
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1294
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.