Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One of the major causes of system performance issues is programs that run in the

ID: 3673862 • Letter: O

Question

One of the major causes of system performance issues is programs that run in the background and are started when the system starts. These programs are usually installed, so they are started from one of two entries in the system registry:

HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Run

HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Run

As a network administrator, you would like to gather information about these registry entries for all the computers in the network. You have selected Windows PowerShell to write a script for this task. Your plan will result in a document with a script for the tasks involved. Because there are security issues that prevent executing the scripts on remote computers, the script will be distributed to all users on the network as a download link on the company intranet. For purposes of this exercise, security issues can be ignored, so the script is not required to take security issues into account.

Provide well-documented source code for a Windows PowerShell script that will perform the following tasks:

Read the registry entries from both of the locations named in the project description.

Compare each entry to a list of acceptable entries. The acceptable entry list is from a text file named "Acceptable_Reg.txt" that will accompany the script when the script is downloaded.

Produce a text file report that lists all unacceptable registry entries. Save the report using the computer name as the file name.

Transmit the report file to the following intranet address:

intranet.xyzcompany.com/bad_reg.aspx

Explanation / Answer

Having too many startup programs not only makes your system take a longer time to start, it also has the potential to waste memory. If you don’t require a program at startup, it’s a good idea to get it out of your startup path.
Unfortunately, tracking down programs that start automatically isn’t as easy as you might think. A program can be configured to run at startup in many ways, not just by having a shortcut in a Startup folder.

Run registry keys cause programs to run each time that a user logs on. The data value for a key is a command line. Register programs to run by adding entries of the form description-string=commandline. You can write multiple entries under a key. If more than one program is registered under any particular key, the order in which those programs run is indeterminate.

The Windows registry includes the following keys:

    HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionRun
    HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun
  
    A program run from any of these keys should not write to the key during its execution because this will interfere with the execution of other programs registered under the key. Applications should use the RunOnce or RunOnceServices keys only for transient conditions,such as to complete application setup. An application must not continually recreate entries under RunServices because this will interfere with Windows Setup.
  
    The "Run" registry key is there to run EVERY time the system is booted in the HKEY_CURRENT_MACHINE (HKLM) and EVERY time that specific user logs in in HKEY_CURRENT_USER. It's like an autoexec.bat or .profile for the machine or user.
  
  
    As the name implies, Windows PowerShell is a shell, not unlike the Command Prompt (Cmd.exe) that's been around since Windows NT 3.1 Cmd.exe isn't going away, but with the availability of Windows PowerShell, there are few reasons to continue using Cmd.exe.
    Using Windows PowerShell isn't all that different than using Cmd.exe—except that Windows PowerShell is, well, more powerful. Like Cmd.exe, Windows PowerShell has a built-in scripting language, although it is much more flexible than Cmd.exe's primitive batch language. With Windows PowerShell, you can automate extremely complex tasks with a language that includes only about a half-dozen built-in keywords.
  
    Windows PowerShell benefits from what Microsoft has learned about security over the past decade plus. By default, Windows PowerShell won't run scripts; it can only be used interactively to run individual commands. If you do enable scripting, you can direct Windows PowerShell to run only digitally signed scripts. All of this is to help ensure that Windows PowerShell doesn't become the next VBScript—a great language that has been frequently misused to create malicious scripts.
  
  

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote