Saturday, April 27, 2024
HomePowershellTips on how to use Web Consumer command to Handle Consumer Accounts

Tips on how to use Web Consumer command to Handle Consumer Accounts


The command Web Consumer lets you handle your native and even your area customers from the command line. It’s primarily used to rapidly add, delete or disable person accounts from the command line. However it could do extra than simply that. The device can be utilized in each command immediate and PowerShell.

For managing area customers, I like to recommend utilizing the PowerShell ActiveDirectory module. It comes with extra choices and lets you filter, copy and search customers and set or change all properties. However as talked about, it’s also possible to carry out primary duties with the Web Consumer command for area customers.

On this article, we’re going to take a better have a look at the Web Consumer command. I’ll clarify how one can add, and take away accounts, change passwords, and extra.

Web Consumer Command

The Web Consumer command is a command-line utility you can run in any terminal on Home windows. However to make use of it you will want to have Administrator permissions on the pc. With out it, you gained’t have the ability to create new person accounts for instance. Additionally, just be sure you open Home windows PowerShell or Home windows Terminal in Admin mode.

Be aware

Should you get the error “System error 5 has occurred. Entry is denied” You then haven’t begin the command immediate or PowerShell with administrator privileges.

Crucial parameters of the Web Consumer command are:

Parameter Description
<username> Specify the username to the account you wish to carry out the motion on
<password> Set or change the password for the desired person account. Use * to get a immediate for the password.
/area Used for managing area accounts
/add Create a brand new person account
/delete Delete a person account
/lively Allow or disable the person account. Choices are sure or no.
/expire Set the date when the account expires
/time Specifies the occasions {that a} person is allowed to log in
/homedir Set the house listing path of the person account.
Web Consumer Instructions

Checklist all customers

Once you enter the command Web Consumer with none parameters, then it’ll record all person accounts on the pc. Should you run the command on the Area Controller, then it’ll record all area accounts.

Web Consumer

# Or it's also possible to kind
Web Customers
net user
Web Consumer outcomes on Home windows 11
net user result domain
Web Consumer outcomes on a website controller

Within the first screenshot above you will note the outcomes on an area pc, the second are all of the customers from the native area.

Once you specify the username you will note all the small print from the person account

# Get the person particulars for Zoe Tucker
web person ztucker
Web Consumer Particulars

Web Consumer Add Account

The Web Consumer command can be utilized to create new person accounts in your pc and in your area. To create a person account you will want so as to add the /add parameter and specify the username. A password is by default not required on an area pc. For area accounts, nevertheless, you will want to specify the password as properly.

# Create a brand new native person account with the login identify lazyadmin
Web Consumer /Add lazyadmin

For coming into the password you will have two choices, you may kind it in plain textual content within the command line or use the * which can present you a immediate to enter the password.

# Create a brand new area person with username testusr and passswd123
Web Consumer /add /area testusr passwd123

# Immediate for the password
Web Consumer /add /area testusr *
Net User Add
Web Consumer Add

The brand new area person is positioned within the built-in OU “Customers”.

When making a person we are able to additionally specify login particulars, dwelling listing path, and so on of the person. I’ll clarify every command later within the article. However to provide you an concept of the attainable choices, we’re going to create a person with the next particulars:

  • Username: testusr
  • Password: immediate
  • Full identify: Take a look at Consumer
  • Password required: sure
  • Allowed to login between: Monday to Friday between 08:00 and 17:00
  • Residence folder listing: lazyadmin.localhometestusr
  • Script path: lazyadmin.localnetlogonwelcome.bat
Web Consumer /add /area testusr * /fullname:"Take a look at Consumer" /passwordreq:sure /time:M-F,08:00-17:00 /homedir:"lazyadmin.localhometestusr" /scriptpath:"lazyadmin.localnetlogonwelcome.bat"

Web Consumer Delete Consumer Account

We will additionally use the command line device to delete person accounts, each native and from the area. For this, you will want to make use of the parameter /delete and enter the username. Essential to notice is that the command device gained’t ask for affirmation. So watch out when utilizing the delete possibility.

# Delete the native person Lazyadmin
Web Consumer /delete lazyadmin

# Delete a website person
Web Consumer /delete /area testusr

Web Consumer Change or Set Password

One of many widespread duties for an IT Helpdesk is to reset a person’s password. In fact, you may reset the password within the Energetic Listing. But it surely’s additionally attainable with the command Web Consumer. Resetting passwords isn’t restricted to area accounts, it’s also possible to use this technique for native pc accounts.

To reset a password you will want to specify the username after which both kind within the password or kind * after which you’ll be able to securely kind the password:

# Set the password for LazyAdmin to passwd123
Web Consumer LazyAdmin passwd123

# Pormpt for the brand new password
Web Consumer LazyAdmin *

When it’s a website person, then simply add the /area parameter. Be sure that the password meets the complexity necessities of the area

# Reset the password for the area person tesusr
Web Consumer /area testusr *

Allow or Disable Consumer accounts

We will additionally use the command-line device to allow and disable accounts. That is significantly helpful when a person is locked out or if you rapidly must disable an account. To do that we’re going to use the parameter /Energetic:sure|no

The command can be utilized for native pc accounts as for area accounts:

# Disable native account
Web Consumer lazyadmin /lively:no

# Disable area person account
Web Consumer tesusr /Area /Energetic:no

To allow an account, merely substitute /Energetic:no with /Energetic:sure

Set Expire date for Consumer Account

If you already know the info that an worker leaves the group then it’s a good suggestion to set the expired date for the account. This manner the account is robotically locked after the desired information. The date format relies on your area settings, however the choices are:

  • MM/DD/YYYY
  • DD/MM/YYYY
  • mmm,dd,YYYY

Account expiration settings usually are not restricted to a website account, it’s also possible to set the expired date on an area Home windows 10 or 11 person account.

# Set expire date for native person
Web Consumer lazyadmin /expires:21/09/2022

# Set expire information for area person
Web Consumer testusr /area /expires:09/20/2022

Set login occasions for Consumer Account

Some accounts are solely allowed for use between particular hours, workplace hours for instance. We will specify these hours with the /time parameter. To specify the time we might want to enter the times and hours between the account is allowed to log in.

You should use completely different notions for the times and hours (12-hour or 24-hour notation), and we are able to specify a number of time blocks by separating them with the semi-column ;.

# Permit login throughout workplace hours solely
Web Consumer lazyadmin /time:M-F,08:00-17:00

# Or in 12-hour notation
Web Consumer lazyadmin /time:M-F,8am-5pm

# Specify a number of blocks
Web Consumer lazyadmin /time:M,08:00-17:00;W,08:00-13:00;F,08:00-17:00

Web Consumer Password settings

Once you create a brand new account you may set a password for the account as properly. However in the case of passwords we’ve two different attention-grabbing parameters, passwordchg and passwordreg. The primary determines if the person can change the password. This setting is actually helpful for kiosk accounts. The person can’t change the password when that is set to no.

# Consumer lazyadmin cannot change it is password
web person lazyadmin /passwordchg:no

The parameter passwordreg is used to specify it a person account will need to have a password. If that is set to no, then the person can take away their password, making the system weak.

web person lazyadmin /passwordreg:sure

Residence Listing Path

The final parameter that I wish to point out is the house listing path. If you wish to retailer the house listing of the person on a community share then you may set the trail to the folder with the parameter /homedir. However make it possible for the total path, together with the person’s folder, exists.

# Set the house listing for testusr
web person testusr homedir:"lazyadmin.localhometestusr"

Wrapping Up

The Web Consumer command is nice when eager to rapidly allow or disable a person account or reset a password. Additionally, it’s nice to handle native pc accounts on small networks. When working with area accounts I choose to make use of the Energetic Listing module in PowerShell.

I hope you discovered this text helpful, in case you have any questions, simply drop a remark beneath.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments