exam questions

Exam MD-100 All Questions

View all questions & answers for the MD-100 exam

Exam MD-100 topic 3 question 45 discussion

Actual exam question from Microsoft's MD-100
Question #: 45
Topic #: 3
[All MD-100 Questions]

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a computer that runs Windows 10. The computer contains a folder named D:\Scripts. D:\Scripts contains several PowerShell scripts.
You need to ensure that you can run the PowerShell scripts without specifying the full path to the scripts. The solution must persist between PowerShell sessions.
Solution: At a command prompt, you run set.exe path=d:\scripts.
Does this meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
forummj
Highly Voted 4 years, 7 months ago
If, like me, you were wondering about this one, then this answer may help. https://superuser.com/questions/1334129/setting-an-environment-variable-in-windows-10-gpodder It's noted that any CMD variable set is only available while the CMD prompt window is open. After that point it is removed.
upvoted 40 times
Anthony_2770
4 years, 5 months ago
Forummj has provided excellent comments in this exam. Keep up the good work
upvoted 18 times
...
...
Anthony_2770
Highly Voted 4 years, 6 months ago
From PowerShell, you run $env:Path += ";d:\scripts". Solution provided in this question is not persistent as indicated above
upvoted 13 times
...
Buruguduystunstugudunstuy
Most Recent 2 years, 1 month ago
Selected Answer: B
The solution provided in the scenario is not correct to meet the goal of running PowerShell scripts without specifying the full path to the scripts. The command "set.exe path=d:\scripts" only sets the value of the PATH environment variable to include the D:\Scripts folder. This will allow you to run commands and executables located in the D:\Scripts folder without specifying the full path, but it will not allow you to run PowerShell scripts without specifying the full path. To run PowerShell scripts without specifying the full path, you should add the D:\Scripts folder to the list of trusted PowerShell script locations. This can be done by setting the ExecutionPolicy parameter for the PowerShell session to RemoteSigned and adding the D:\Scripts folder to the list of trusted locations.
upvoted 2 times
Buruguduystunstugudunstuy
2 years, 1 month ago
By adding the D:\Scripts folder to the list of trusted PowerShell script locations, you will be able to run PowerShell scripts located in the folder without specifying the full path. Therefore, the correct answer is B. No. Here's how: 1. Open PowerShell as an administrator. 2. Run the command "Set-ExecutionPolicy RemoteSigned" to allow the execution of local PowerShell scripts that are signed by a trusted publisher. 3. Run the command "$env:PSModulePath=$env:PSModulePath+";D:\Scripts"" to add the D:\Scripts folder to the list of trusted PowerShell script locations. 4. Test running a PowerShell script located in the D:\Scripts folder without specifying the full path.
upvoted 1 times
...
...
williamlamata
2 years, 2 months ago
The command "$env:Path += ";d:\scripts"" is a valid solution to add the "D:\Scripts" folder to the system path so that you can run PowerShell scripts in that folder without specifying the full path.
upvoted 1 times
...
williamlamata
2 years, 2 months ago
B. No. The command "set.exe path=d:\scripts" will set the value of the PATH environment variable to "d:\scripts", but it will not add the path permanently or persist between PowerShell sessions. As a result, this solution will not meet the goal of allowing the PowerShell scripts to be run without specifying the full path and persisting between sessions. To meet the goal, you can add the path to the PowerShell environment variable by running the following command in PowerShell: ruby Copy code [Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Scripts", "User") This command will add the "D:\Scripts" path to the existing value of the PATH environment variable for the current user and persist between PowerShell sessions. After running this command, you can run the PowerShell scripts without specifying the full path.
upvoted 1 times
...
Wojer
2 years, 8 months ago
New-Variable -Name 'TestVariable' -Value 'Test Value' -Option AllScope,Constant I think this is the answer
upvoted 1 times
...
CARIOCA
3 years, 10 months ago
Essa questão ficou muito dividida no gabarito, afinal qual seria a resposta e qual a justificativa? Após um debate de 5 comentários, o gabarito é o mesmo ou não?
upvoted 1 times
...
AVP_Riga
4 years, 1 month ago
System properties > Advanced > Environment Variables dialog
upvoted 2 times
...
silicon_shady
4 years, 4 months ago
To permanently set/append the path from the command prompt (elevated): C:\> setx path "%PATH%;C:\path\to\directory\" Ref: https://www.shellhacks.com/windows-cmd-path-variable-add-to-path-echo-path/
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago