Managing local users and groups
When you are working with building new systems, there may be instances where you need to create new users and groups on a system. While you may be familiar with the net
commands to manipulate the local users and groups, PowerShell provides other options for communicating with the local system. This section displays how to leverage ADSI calls to interact with local users and groups.
The first step in leveraging ADSI to communicate with a local or remote system is to set up the connection string. This is done by calling the string [ADSI]"WinNT://SystemName"
and storing the call in a variable such as $ADSI
. After the connection is made, you can execute different methods and interact with local objects of that system.
Managing local users
To create a user leveraging the ADSI connection, you first have to declare the connection by calling [ADSI]"WinNT://SystemName"
and setting it to the $ADSI
variable. You then leverage the .create()
method of...