Question

4. Using Technique 1 from the text book, write the PowerShell script that will create a custom object named Q4 with the prope


21.2.1 Technique 1: using a hash table Lets start with the way that we prefer ourselves. Call it the official way, if you li
Syntax for creating custom objects 347 $props = @{OSVersion=$os.version Model=$cs.model Manufacturer=$cs.manufacturer BIOSSer
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is a powershell script to generate the output requested. Remember to replace the value of properties "FirstName" and "LastName" with actual values you would like to use.

[hashtable] $objectProperties = @{}

$procId = Get-Process | Select -first 1 | Select -expand Id

$procName = Get-Process | Select -first 1 | Select -expand ProcessName

$objectProperties.Add("FirstName", "your first name")

$objectProperties.Add("LastName", "your last name")

$objectProperties.Add("ProcessName", $procName)

$objectProperties.Add("ProcessID", $procId)

$Q4 = New-Object -TypeName psobject -Property $objectProperties

Write-Output $Q4

Add a comment
Know the answer?
Add Answer to:
4. Using Technique 1 from the text book, write the PowerShell script that will create a...
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
  • (In Linux) 1. Create a file to write to from your script and save it as...

    (In Linux) 1. Create a file to write to from your script and save it as “.txt”. 2. Write the following information to the file that you created in Step 1: Today's date Your full name Your student ID The name of your course What directory you are in File permissions of the file that you created that allow everyone to read, write, and execute The long list of files in your current directory, providing all items and their process...

  • Problem 1 Write a BASH script to create a user account from the Linux system on...

    Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...

  • A) Please implement a Python script to define a student class with the following attributes (instance...

    A) Please implement a Python script to define a student class with the following attributes (instance attributes): cwid: student’s CWID first_name : student’s first name last_name: student’s last name gender: student’s gender gpa: student’s gpa Please make these attributes as private ones so they have to be accessed via getter/setter methods or property. For this purpose, please define a getter/setter method and property for each of the attributes. Another thing you need to do is to define a constructor that...

  • Easy Javascript questions You can use window.history to retrieve the history object. Using the history object, what methods can you call to navigate backwards and forward to web pages that have been...

    Easy Javascript questions You can use window.history to retrieve the history object. Using the history object, what methods can you call to navigate backwards and forward to web pages that have been visited recently? The answer is not in the book. See https://developer.mozilla.org/en-US/docs/Web/API/History. Think about the situation where the alert message displays “your reply was false.” Describe the type of person who would generate that output—someone who always tells the truth, someone who always lies, or some other type of...

  • USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file,...

    USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file, and print (user’s choice of printers) identical form letters to each recipient. Either E197, E-199, E-194 printers or to project2.output. Prompt the user for their choice. 2) The script and output file are due: per Moodle timeline. Please upload your fully functioning script (project2.sh) your data file (project2.input) and your output file (project2.output) into Moodle. 3) Requirements of the script. a. You can use...

  • Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.   and please put comment with code! Problem:2 1. Class Student Create...

    Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.   and please put comment with code! Problem:2 1. Class Student Create a "Hello C++! I love CS52" Program 10 points Create a program that simply outputs the text Hello C++!I love CS52" when you run it. This can be done by using cout object in the main function. 2. Create a Class and an Object In the same file as...

  • Complete each of the following exercises from the Deitel book, using the indicated C# project names....

    Complete each of the following exercises from the Deitel book, using the indicated C# project names. You should use a .NET Framework Console application type for each project. All projects should be part of a single solution named: Cs2Apps. How to setup multiple Projects in one Visual Studio Solution When creating the first Project, make sure to uncheck the box for putting the solution and the project in the same folder. This will create a separate folder with the solution...

  • Mostly SHMUP questions What must be done in code to increase the maximum shield strength from 4 ...

    Mostly SHMUP questions What must be done in code to increase the maximum shield strength from 4 to 6?? What must be done with visual feedback and art production to increase the maximum shield strength from 4 to 6? Generally speaking, what is a Quaternion? Gibson creates a utility script through a process of iterative development. What are the benefits of building up functionality over time when coding? Explain how the script that checks if items are on or off...

  • Part 1: Using Idle Write a Python Script that Does the Following 1. At the top...

    Part 1: Using Idle Write a Python Script that Does the Following 1. At the top of your program, import the math library as in from math import * to make the functions in the math module available. Create a variable and assign into it a constant positive integer number of your choice. The number should be at most 10. 1 Suppose we call this variable x for this writeup document Try something like x = 4 2. Create another...

  • Python Code Question# 1 General Instructions Create a class called LawnService that takes in the length...

    Python Code Question# 1 General Instructions Create a class called LawnService that takes in the length and width of a yard, along with the current state of the yard. The currect state can be: poor, acceptable or great. Within this class include a constructor that will assign these values to attributes. Additionally create three methods that will be named and do the following: *DetermineApplication: This method will focus on the lawn status attribute. If the status is poor, the lawn...

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