Question

Write a PowerShell script that will accept one parameter, and then use Write-Host to write the...

Write a PowerShell script that will accept one parameter, and then use Write-Host to write the parameter to the screen.

PowerShell script:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#parameter is variable that stores the parameter passed.As we need only one parameter we take the 1st argument.


$parameter=$args[0]


#write-host used to print the parameter on screen.

write-host "Parameter passed is :",$parameter

OUTPUT :

Add a comment
Know the answer?
Add Answer to:
Write a PowerShell script that will accept one parameter, and then use Write-Host to write the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create the PowerShell script using NotePad (or use the PowerShell ISE). The PowerShell script is a...

    Create the PowerShell script using NotePad (or use the PowerShell ISE). The PowerShell script is a very simple one that simply prints the line: “Today is: “ followed on the next line by the actual date and time when the script is executed. (Major hint: use the cmdlet get-date.) 'Today is' going to bed red,while the date and time is going to be green. Name your script: get-daymessage.ps1. Name your task: displayDate.

  • Exercise 2: Challenge Exercises 1. Write a Powershell script to Check If a Service is Installed...

    Exercise 2: Challenge Exercises 1. Write a Powershell script to Check If a Service is Installed and Working 2. Write a Powershell to Checks If a File Exists 3. Write a Powershel lfind all the dlls under the Windows folder 4: Write a script sorting process by their start time 5: Write a script to find all files last modified before a certain date. 6: Write a script to find the event log entries that occur most frequently. 7: Write...

  • 1. Write a PowerShell script to Count the Temporary Files 2. Write a PowerShell script to...

    1. Write a PowerShell script to Count the Temporary Files 2. Write a PowerShell script to find Windows Log Files with 'Errors'

  • Write a PowerShell script. Make sure to: Comment your script by including your name, date, and...

    Write a PowerShell script. Make sure to: Comment your script by including your name, date, and short description what the script does The script receives two arguments/parameters, first one should be a string and the second one an integer number. Both should be passed to the script as (positional) arguments/parameters Check if there are two passed parameters Check if passed parameters are as expected (check if first is string and secondis integer). You can use param() here. Displays on the...

  • I am trying to write a Powershell script that will automate the deletion process of certain...

    I am trying to write a Powershell script that will automate the deletion process of certain files. These files are older than 6 months old, and need to be deleted. If my $Path = "C:\Users\username\Documents\Test\", what would be the Powershell script to DELETE every file and directory older than 6 months old in the 'Test' directory. I am new to Powershell, please explain the parts of the script as well.

  • Task 12: Working with Windows PowerShell ISE You can use the Windows PowerShell Integrated Scripting Environment...

    Task 12: Working with Windows PowerShell ISE You can use the Windows PowerShell Integrated Scripting Environment (ISE) to create, run, and debug commands and scripts. The Windows PowerShell ISE consists of the menu bar, Windows PowerShell tabs, the toolbar, script tabs, a script pane, a console pane, a status bar, a text-size slider and context-sensitive Help. It works for both local and remote scripts. Using the Windows PowerShell ISE gives you many different advantages when creating scripts. Although it can...

  • Powershell Script

    Create a powershell script that will prompt user to enter the following information:Please choose your selection:1. Enter Grade Information2. Write File3. ExitIf user choose 1) then the script should ask the user for their course number (ex. ABC-123), course name and letter grade received.If user choose 2) then the script should generate a CSV file to save all dataIf user choose 3) the script should stop

  • 4. Using Technique 1 from the text book, write the PowerShell script that will create a...

    4. Using Technique 1 from the text book, write the PowerShell script that will create a custom object named Q4 with the properties and values as indicated in the below table. The last line in your script should output the object to the screen. Property Name FirstName LastName ProcessName Property Value Your first name Your last name The name of the first process running on your VM. You should use Get-Process in your script to retrieve this name. The ID...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT