Question: #4. Use Invoke-Command to code a One-to-Many Remote Connection to remote computer (Using Variables) #5. Use Invoke-Command to Code a One-to-Many Remote Connection to a

#4. Use Invoke-Command to code a One-to-Many Remote Connection to remote computer (Using Variables) <# -Code a variable named "$Computers" and use a parenthetical to get content from the ComputerNames.txt file (Make sure you have copied the ComputerNames.txt file to the root of drive C:\ before trying this) The results of the parenthetical should store the Computer Name(s) within the variable -Code a variable named "$Cred" and use a parenthetical with the Get-Credential cmdlet Run this line of code and it will prompt you for the Username and Password for the remote computer. The results of the parenthetical should store the Username and Password within the variable -Code a variable named "$SB4" and use a set of curly brackets {} to store all the commands you intend to send to the remote computers The scriptblock of commands should be stored within the variable -Have the remote computers do the following tasks (all these tasks should happen on remote computers): Use the Get-PSDrive cmdlet to retrieve info about the "C" drive Use a filter so that only results where the free space is less than 100 are returned Note: This syntax should be written within the $SB4 variable -Use invoke-command with the variables as input for the parameters -ComputerName, -ScriptBlock, and -Credential. -Pipe the results of invoke-command to other cmdlets locally to achieve the following tasks (all these tasks should happen locally): Sort by PSComputername (lowest to highest) Format-table with three properties -Custom Property "DriveLetter" (from the Name property) -Custom Property "FreeSpace" (from Free property) (Should be in GB, displayed as INT, and left aligned) -PSComputerName #>

#5. Use Invoke-Command to Code a One-to-Many Remote Connection to a remote computer and send script to complete. <# Step 1: Code Script named "AssessmentModule1.PS1" and save script on C:\ -The Script should complete the following Tasks: Obtain a list of processes. Filter the PowerShell Process out of the output Sort the Processes by CPU with the highest CPU usage at the top of the list Only display the 10 processes with the highest CPU usage Format the output in a table (Display only three properties: ProcessName, ID, and CPU), and alter the display of the CPU info by showing only 2 decimal places Lastly, save the results to a txt file named ProcessCPU.txt on the root of C:\ Step 2: Use Invoke-Command to run script on remote computers -Reuse the variables "$Cred" and "$Computers" created in question 4. -Use the -FilePath parameter to send the script named "AssessmentModule1.PS1" to the remote computers Step 3: Use Invoke-Command to ensure the file output of the script ("C:\ProcessCPU.txt") was created successfully on the remote computer #> #Step 4: Write the PowerShell syntax to delete the C:\ProcessCPU.txt from Client1 without being prompted. #Then write the PowerShell syntax to show that it has been deleted

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!