PowerShell Quiz: Are you already a PowerShell developer?

Hi followers!

Test your PowerShell knowledge with this 15 questions quiz. It’s anonymous and free.

You can either use the link below or simply scan the QR code on your smartphone or tablet.

And don’t be disappointed if the score is not too high, you have learned something!

Have fun and good luck!



QR Code:

Are you already a PowerShell developer_

Categories: PowerShell

Tagged as: ,

4 replies »

  1. There are issues with this quiz:
    Q: “Why is $hp empty when running it like in the screenshot?”
    The answer is that $hp doesn’t exist outside of the function scriptblock, making it a global variable would make it work, but not if you were to invoke the code on a remote machine

    Q: (tidbit) “You created a code that creates 20 dummyfiles with random size. Which other code will do the same?”
    Who starts a for loop on 1 rather than 0 and uses -le rather than -lt, especially since often you’re using it to loop over an array who’s indicies start at 0.

    Q:”What kind of object is shown in the screenshot?”
    This question is bizarre, because you’re seeing an array of unknown type getting a PsCustomObject which has been created with the properties/values from an System.Collections.Specialized.OrderedDictionary, which in turn has multiple objects referenced inside it.
    And the answer is “Hashtable”? There are loads of objects in the screen capture

    Q:What is the difference between Write-Error and throw in PowerShell scripts?
    Throw doesn’t terminate the script, it generates a terminating error, which is very different. And Write-Error can generate terminating error’s depending on the erroractionpreference varable

    Q: What is the purpose of the [CmdletBinding()] statement in line 3 and the .ShouldProcess statement in line 11?
    [CmdletBinding()] doesn’t enable WhatIf and Confirm, it’s the “SupportsShouldProcess = $true” inside CmdletBinding. Not only that, since [CmdletBinding()] is required to enable SupportsShouldProcess, it does also “enable code execution with the statements Begin, Process, End” so this answer should also be correct.

    Q: “Your function Send-Message must accept PipelineInput. Why is only the second pipelineobject “Hallo2” displayed? What happens to “Hallo”? How can you solve it?”
    The answer is not only to use “Begin”, “Process”, and “End” blocks, but specifically to then also put the code dependant on the unique parameter in the Process block.

    Q: “How can you secure passwords in PowerShell scripts that must be run without any user interaction?”
    The answer is a HUGE no, when it comes to using the convert secure string cmdlets to encrypt/decrypt plain text passwords.
    You can securely store a password as an encrypted string by reading your password as a securestring (I.E from Get-Credential or Read-Host with the -AsSecureString switch), and then using ConvertFrom-SecureString to generate an encrypted hex string, that only your account can convert back. Once it’s converted back, it should ever be then converted to plain text.

    Q: “You create a script for sending messages to the users desktop on remote computers. However, the message isn’t displayed on remote computers. With regard to only line 6 and line 23, how can you solve that problem?”
    Adding $Using: before the variable name is highly inflexible, because it’s treated as a constant in the scriptblock and cannot be manipulated. It’s much better to provide use a parameter called $Message in the scriptblock, and then pass $Message to the scriptblock using the -ArgumentList command of Invoke-Command


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.