Automating new user and other stuff input


Recommended Posts

Hello gang,

its been a while but i still have questions.

Now it being the end of the year i have a buch (about 48) new users to put into my system (win2k AD xp clients).

What i want to know is how can i do this automated? Like having an excels or usernames where cetain scripts could run off perhaps?

Thats one issue - but i was wondering now and this is the real pain in thass part of new users.

Is that i have to go into the File server and make a new folder and name it after that user and then give full access to that folder for that user - hence creating a home folder for the user only acdesible by themself and ofcourse IT administration.

Can i do this automated? Im sure big ass companies dont sit there and do this stuf manually.

Cheers fellas

Create a share with secure permissions for users to create home folders:

How to dynamically create security-enhanced redirected folders by using folder redirection in Windows 2000 and in Windows Server 2003

http://support.microsoft.com/default.aspx?...kb;en-us;274443

Create the target folder in the user's context - you can do this with a logon script e.g:

MD \\SERVER\HOME\%USERNAME%

or via Folder Redirection - redirect My Documents to the target folder: e.g. \\SERVER\HOME\%USERNAME%\My Documents

Then in a logon script map the home drive the location created. This way you don't need to add anything to the user properties.

You can also use the same approach listed in the KB article for secure profile folders as well.

Here is what we use to add pupils in our school. First is an example of the text file that is read by the batch file. The username, password and description are seperated by comma's but no spaces. The description makes it handy to find them in active directory afterwards when you sort by that column.

pupil.txt

johnsmith,password,year 10
MarkJones,megatron,year 8
JaneRussell,magic,year 9

AddPupils.bat

@echo on

for /f "tokens=1,2,3 delims=," %%1 in (pupils.txt) do (

:: Add user (net user username,password
:: comment is description - scriptpath is the logon
:: script and profile path is the location of their
:: profile. Only username and password are compulsary'

	net user "%%1" "%%2" /add /comment:%%3 /scriptpath:pupil.bat /profilepath:\\%computername%\profiles$\pupils

:: Make their home folder

	md "d:\users\pupils\%%1"

:: Set permissions on home folder

	cacls "d:\users\pupils\%%1" /G "%%1":F /e
	cacls "d:\users\pupils\%%1" /G Administrators:F /e
	cacls "d:\users\pupils\%%1" /G Managers:F /e
	cacls "d:\users\pupils\%%1" /G Staff:F /e
	cacls "d:\users\pupils\%%1" /E /R Everyone
	cacls "d:\users\pupils\%%1" /E /R Users

:: Add new user to appropriate group

	net group Pupils "%%1" /add

:: Share the user's folder and set permissions

	net share "%%1$"="d:\users\pupils\%%1" /cache:none /grant:"%%1",full /grant:"staff",full /grant:"managers",full /grant:"administrators",full
)

I've just noticed that I should have put quotes around the comment part. Without the quotes it will fail if you have a space in there - which I did in my example :blush:

So that line should be:

 net user "%%1" "%%2" /add /comment:"%%3" /scriptpath:pupil.bat /profilepath:\\%computername%\profiles$\pupils

One other thing might be worth considering. You will see that we've given the user full control to his own folder, which you might think makes sense. Unfortunately, that means they can take ownership of files and folders in there, so sometimes either deliberately or by accident they will make themselves the owner and remove the rights of the administrator etc. That is very easy to get back, of course, but it can mean that *some* types of backup will then skip the guy's files because it doesn't have access to the folder.

To solve this, we now only give the user read,write,change access to his folder so he now doesn't have the ability to take ownership OR remove other people's rights. Change the first 'cacls' line in batch file as follows if you want to make this happen

 cacls "d:\users\pupils\%%1" /G "%%1":R /e
 cacls "d:\users\pupils\%%1" /G "%%1":W /e
 cacls "d:\users\pupils\%%1" /G "%%1":C /e

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Windows Server gets DNS over HTTPS (DoH) support by Usama Jawad For the past few months, Microsoft has been previewing DNS over HTTPS (DoH) for Windows DNS Server, touting it as a foundational upgrade for zero-trust enterprise networks. It essentially introduces encrypted, authenticated DNS for the networks rather than transmitting DNS traffic in clear. Now, the company has introduced the general availability (GA) of this feature. The GA of DoH encourages organizations to deploy the solution in production environments without implementing a new client-to-resolver architecture. DoH helps improve the overall security of the network and reduces the risk of spoofing due to its zero-trust design. This is a significant change because pretty much every interaction with the network requires interfacing with DNS. DoH offers several advantages over standard DNS traffic, such as encryption using HTTPS, preventing unauthorized inspection, man-in-the-middle attacks, and traffic analysis. Since it leverages TLS certificates so that clients can verify the identity of the DNS server, it prevents spoofing through this authentication mechanism. Additionally, it's built on the DoH standard defined by the Internet Engineering Task Force (IETF), which means that it should work with modern RFC 8484-compliant clients. Finally, it integrates into the existing network architecture seamlessly and can even run in parallel with standard DNS, so that customers can migrate to the new technology at their own pace. Microsoft says that in the past few months of preview, DoH has become more stable, and customers can confidently deploy it in production environments with proper guidance. Microsoft has emphasized that migrating to DoH is necessary for organizations that are moving toward zero-trust DNS solutions. Windows clients already support DoH, but the latest availability on Windows Server provides encrypted DNS to all endpoints. The company has also mentioned that "while this release focuses on encrypting client-to-resolver communication, support for encrypted communication between Windows DNS Server and upstream DNS resolvers is planned for a future update." You can follow Microsoft's guidance to deploy DoH here, but keep in mind that you need a Windows Server 2025 installation with the latest Patch Tuesday updates installed.
    • Lol I had one of these turn faulty in Jan, guess it wasn't just bad luck lol
    • I'm team Rossmann all the way. I have the exact same NVME, altough not in an array like him.
    • It had gone weeks ago. Although thinking about it I'm on the beta.
    • They thought value of their goods would forever only drop like it used to and didn't account for sudden increase in price because of all the Ai hype. Tough luck Samsung, don't try to weasel this one out. Also American customer protection laws are a**. In Europe, you need to be compensated for a functioning product of same or better characteristics (not same price point as when it was originally bought!) if it can't be repaired and when you receive a replacement product your warranty starts from scratch because you received a different item than you previously had and old warranty thus cannot apply to it anymore. If your actual item was successfully repaired, warranty gets extended for the period the item was in service. If item is repaired to a significant extent, warranty also starts over from scratch because major part of it was replaced. Americans need to fight to get this kind of consumer protections because they are constantly getting screwed over.
  • Recent Achievements

    • Week One Done
      davidbazooked earned a badge
      Week One Done
    • One Month Later
      Jamswaz earned a badge
      One Month Later
    • Week One Done
      Jamswaz earned a badge
      Week One Done
    • Rookie
      Marzoid went up a rank
      Rookie
    • Community Regular
      coch went up a rank
      Community Regular
  • Popular Contributors

    1. 1
      +primortal
      511
    2. 2
      PsYcHoKiLLa
      184
    3. 3
      +Edouard
      159
    4. 4
      Steven P.
      83
    5. 5
      ATLien_0
      75
  • Tell a friend

    Love Neowin? Tell a friend!