PowerShell Commands and Scripting
Test your knowledge of PowerShell commands, operators, parameters, CmdLets, and output formatting
Questions
Which command is used to print the output of a CmdLet?
- Out-FIle
- Out-Host
- Out-Null
- None of the above
Which CmdLet is used to create a new item in the file system or registry?
- New-Item
- Create-Item
- Move-Item
- Invoke-Item
Which command is used to list all the Windows PowerShell CmdLets?
- Get-Member
- Get-ChildItem
- Get-Command
- Get-AllCommand
Which formatting option is used to format the output of a command result to a tabular result set?
- Format-List
- Format-Table
- Format-Wide
- Format-Custom
Which command is used to get the paged output from a CmdLet?
- Out-Host –Paging
- Out-String –Paging
- Out-Null –Paging
- Out-buffer –Paging
What will be the value of the variable $X in the below expression $x=10*2 / 5 * 2 + 5 * 5
- 31
- 32
- 33
- 34
The “-Verbose” parameter is used in a command to
- Generate detailed trace info about the operation
- Generate programmer level detail about the operation
- Determine how the CmdLet responds when an error occurs
- Specify a variable to store the output from the command during processing
What are the different types of operators available in Windows PowerShell?
- Compare Operators
- Math Operators
- Logical Operators
- All of the Above
Which among the following is not a valid Logical Operator in PowerShell?
- -and
- - notlike
- -!
- -or
Out of the below options, which one is not a common parameter in PowerShell command?
- Confirm
- Debug
- Warn
- Force
Which among the following is not a suggested parameter in PowerShell command?
- ComputerName
- Exclude
- OutBuffer
- All of the above
Which CmdLet can be used to export all the processes running in a system to a CSV file?
- Get-Process | Export-CSV
- Set-Service| Export-CSV Processes.csv
- Get-AllProcess | Export-CSV Processes.csv
- Get-Process | Export-CSV Processes.csv
“-Confirm” is what type of parameter in PowerShell
- Permissive Parameters
- System State Parameters
- Ubiquitous Parameters
- Suggested Parameters
Which command is used to explain what will happen if the command is executed, without actually executing the command?
- -WhatIf
- -WhatIIf
- -WhatHappens
- All of the above
Which command is used to create an alias in PowerShell?
- Get-alias
- Set-alias
- Create-alias
- Remove-alias
Which operator is used to do a case sensitive text data comparison in PowerShell?
- -eq
- -neq
- -ceq
- -ieq
The statement “PowerShell Commands are not Text-based rather Object-based” is true/false?
- True
- False
Which are the valid array declarations in PowerShell among the following options
- $Number = 1,2,3,4,5
- $DescriptionArray= “This”, “is”, “a”, “Sample”, “Variable”
- $x = @(1, 2, 3, 4, 5)
- $y = @[6,7, 8, 9, 10]
What will be the value of $X if the below statement will be executed? $X = (1 -eq 1) -and (2 -eq 2)
- True
- False
What are the valid wild card characters can be used in PowerShell while executing the Get-ChildItem CmdLet?
- * ( A star)
- ? (A Question Mark)
- [..] (Opening left and closing right Bracket )
- . {..} (curly brackets)