Ipt1 Reviewer
Ipt1 Reviewer
1. It is the name of the new way for managing the command line that is created by Microsoft in
Monad
2002.
Background Job 2. It is a feature of PowerShell that runs a command without interacting with the current
session.
Powershell 3. It is a feature of PowerShell that lets you run any Windows PowerShell command on one or
Remoting more remote computers.
4. Who published the white paper in 2002?
Jeffrey Snovcr
1. When you start a background job, a job object does not return immediately, even if the job takes
False an extended time to finish. You can continue to work in the session without interruption while the
job runs.
2. Scheduled jobs are stored on file and registered in Task Scheduler. The jobs can be managed in
False
Task Scheduler or by using the Scheduled Job cmdlets in Windows PowerShell.
3. In the ISE, you can run commands and write, test, and debug scripts in a single Windows-based
True
graphic user interface.
4. You can establish persistent connections, start interactive sessions, and can't run scripts on
False
remøte computers.
5. Command names, parameter names, argument values and file paths can all be completed by
False
pressing the Enter key. The Tab key is the default key binding on Windows.
IPT1 – FT | QUIZ 2
Echo 1. What is the command that is used to print the variables or strings on the console?
Variable 2. It is a unit of memory in which the data is stored.
3. It is the default execution policy for windows client computers that permits individual
Restricted
commands, but does not allow scripts.
4. It is the default execution policy for non-windows computers and cannot be changed, there is a
Unrestricted
risk of running malicious scripts
Set-Execution
5. What is the command that is used to set the execution policy to run the scripts?
Policy
ps1 6. What is the extension file for the scripts of the PowerShell to run the scripts?
get-process 7. It is a command that get the processes that are running on the local computer.
clear-variable 8. What is the command that is used to delete the value of the variable?
$ 9. In Windows PowerShell, the name of a variable starts with what sign?
Concatenation 10. What operator can we use to join two strings together?
null 11. What is the default value of the variable if we didn't assign anything?
12. It requires that all scripts and configuration files be signed by a trusted publisher, including
AllSigned
scripts that you write on the local computer.
13. It is default execution policy for windows server computers in which it requires a digital
RemoteSigned
signature from a trusted publisher on scripts and configuration file.
Assignment 14. What kind of operator do we use to assign a specified value to the variable?
none of the above 15. Which of the following is the not a valid variable name (excluding the sign)?
True $a = $true
$b = $false
$c = $a -and (-not $b) -or $b
$c
IPT1 – FT | QUIZ 3
3.1 | IDENTIFICATION
ADDITIONAL
➢ In PowerShell, you can assign multiple variables in one line using array assignment or the Set-Variable cmdlet.
➢ You can use PowerShell to prompt for user input with the Read-Host cmdlet. This cmdlet allows you to get input
from the user during script execution.
do {
$input = Read-Host -Prompt $Prompt
$valid = & $ValidationScript $input
if (-not $valid) {
Write-Host "Invalid input, please try again." -ForegroundColor Red
}
} while (-not $valid)
return $input
}
if ($number2 -ne 0) {
$quotient = $number1 / $number2
} else {
$quotient = "undefined (cannot divide by zero)"
}
ACTIVITY
Steps:
1. Open Windows PowerShell ISE. Create a script that will display a greeting and a random name of your
groupmate with today’s date.
2. Create a variable that will hold this greeting, “Hello World! Welcome to IPT1.”
3. Create a variable that will hold today’s date.
4. Create an array of your names in your group.
5. Create a variable that will hold the random name.
6. Print/display the greeting, random name, and today’s date.
7. Run the script 3 times.
➢ Variable is a unit of memory in which the data is stored. In PowerShell, the name of a variable starts with a dollar
sign $. The name of variables is not case sensitive and can include spaces and special characters. When you
assign a value for a variable, you must use the assignment or equal operator =.
o Example:
o $firstName = Diwata
o $lastName = Pares
o $123
o $extension_Name
➢ Array is a data structure that can hold a collection of items. The code below is the basic syntax in creating an
array in PowerShell:
o $arrayName = @ (arrayItem1, arrayItem2, arrayItem3…..arrayItem10)
➢ “Get-Date” is a command where it returns the date today.
➢ “Get-Random” is a command where it will return a random value.
Part 1:
1. Create a variable called $studentName and assign it with a value "Juan Dela Cruz".
2. Create another variable called $subjectScore with a floating-point number representing a grade 85.5.
3. Combine $studentName and $subjectScore into a sentence like "Juan Dela Cruz scored 85.5 in the subject." and
store it in a new variable called $result.
Part 2:
1. Create a variable called $scoreString and set it to "92".
2. Convert $scoreString to an integer and store it in a new variable called $scoreInt.
3. Multiply $scoreInt by 2 and store the result in $finalScore. Ensure $finalScore is an integer.
Part 3:
1. Create three variables, $num1, $num2, and $num3, and assign them the values 10, 15.5, and 20, respectively.
2. Calculate the average of these three numbers and store it in a variable called $average. Ensure the average is a
floating-point number.
Part 4:
1. Create a variable called $grade and set it to 78.
2. Use an if-statement to check:
3. If $grade is greater than or equal to 90, set $gradeLevel to "A".
4. If $grade is greater than or equal to 80, set $gradeLevel to "B".
5. If $grade is greater than or equal to 70, set $gradeLevel to "C".
6. Otherwise, set $gradeLevel to "D".
Part 5:
1. Use $gradeLevel and $studentName variables to create a sentence: "Juan Dela Cruz received a _ grade."
2. Store this sentence in a new variable called $finalResult and display it in uppercase letters. Use ToUpper() method.
➢ PowerShell does not have built-in symbolic operators like >, <, >=, or <=. You muse the named comparison
operators for numeric and string comparisons. Use “-gt” to check a value is greater than another, and “-ge” to
check if a value is greater than or equal to another. On the other hand, use “-lt” to check if a value is less than
another, and “-le” to check if a value is less than or equal to another. Lastly, “-eq” to check if two values are
equal, and “-ne” to check if two values are not equal.