SK0-004 Exam: Mapping a Script to a User's Home Directory | CompTIA Server+

Mapping a Script to a User's Home Directory

Prev Question Next Question

Question

Which of the following will correctly map a script to a home directory for a user based on username?

A.

\\server\users$\username B.

\\server\%username% C.

\\server\FirstInitialLastName D.

\\server\$username$

B.

Reference: https://social.technet.microsoft.com/Forums/windows/en-US/07cfcb73-796d-48aa-96a9-08280a1ef25a/mapping-home-directory-with-username-variable? forum=w7itprogeneral.

Explanations

Which of the following will correctly map a script to a home directory for a user based on username?

A.

\\server\users$\username

B.

\\server\%username%

C.

\\server\FirstInitialLastName

D.

\\server\$username$

B.

https://social.technet.microsoft.com/Forums/windows/en-US/07cfcb73-796d-48aa-96a9-08280a1ef25a/mapping-home-directory-with-username-variable?

The correct answer to the question is B. \server%username%.

Explanation:

In a Windows environment, it is common to map a network drive to a user's home directory using a script. The script will typically use variables to reference the user's username and map the drive accordingly.

Option A, \server\users$\username, is incorrect because it uses a literal string "username" instead of referencing the actual username variable.

Option C, \server\FirstInitialLastName, is incorrect because it assumes that the user's home directory is based on their first initial and last name, which may not always be the case.

Option D, \server$username$, is incorrect because it uses a dollar sign ($) instead of a percent sign (%) to enclose the username variable.

Option B, \server%username%, is the correct answer because it correctly references the username variable using percent signs and will map the drive to the user's home directory based on their username.