Reputation: 321
I'm automating the process of setting up a service on windows and one of the steps involves creating an account that can be configured as the "Log on as" user for the service.
My script currently has a problem where every time a new user is created in the machine a home directory gets created under /Users/%account%
This account does not need a home directory. Also, the script may run more than once in a machine and the account may be replaced, so I don't want a home directory structure to be created every time.
Is there a way to tell Windows that it shouldn't create a Home directory for the account?
Upvotes: 2
Views: 3368
Reputation: 70943
The %account% folder you see in your \users
folder is not exactly a home directory, but a profile directory. It is the place where are saved the files (NTUser.dat) that store the registry hives for the CURRENT_USER
registry branches and all the configuration for the user. Every account needs a profile and if not present, it will be created on logon from the default user profile.
So, you have two options:
use one of the already present service accounts (local system, local service or network service). You will not avoid the presence of a profile, but will reuse the present ones
use a virtual account defining the account in the service configuration LogOn tab as NT SERVICE\nameOfYourService
See Service Accounts Step-by-Step Guide for more information
Upvotes: 2