Introduction to Secure PowerShell Scripting
Final Quiz
Connecting to LMS...
Progress: in progress
Assessment
1. Why does secure PowerShell scripting matter?
A. PowerShell can automate powerful administrative actions, so mistakes can affect security, reliability, and operations
B. PowerShell scripts cannot change systems
C. PowerShell is only used for formatting text
D. PowerShell removes the need for access control
2. Which input should be treated as untrusted?
A. Only data typed by anonymous internet users
B. Parameters, files, pipeline input, environment variables, and external service responses
C. Only malicious-looking strings
D. Nothing inside an internal network
3. What does ValidateSet help enforce?
A. A script must be signed
B. A credential must rotate automatically
C. A command must run remotely
D. A parameter value must come from an allowed list
4. Why is Invoke-Expression risky?
A. It always validates parameters
B. It prevents command injection
C. It can execute constructed strings as PowerShell code, which may turn unsafe input into commands
D. It replaces credential handling
5. What is splatting useful for?
A. Passing parameters in a structured way using a hashtable or dictionary-like collection
B. Encrypting passwords
C. Disabling logging
D. Bypassing authorization
6. Why should secrets not be hard-coded in scripts?
A. Hard-coded secrets rotate automatically
B. Scripts may be copied, committed, shared, logged, or exposed
C. Hard-coded secrets are safer than managed stores
D. Hard-coded secrets prevent misuse
7. What is PSCredential commonly used for?
A. Creating random file names
B. Signing every script automatically
C. Representing a username and credential object for authentication workflows
D. Formatting JSON logs
8. Why should scripts avoid unnecessary elevation?
A. Elevation always improves safety
B. Least privilege only applies to web apps
C. Administrative scripts cannot cause harm
D. Higher privileges increase potential impact if the script has a bug or is misused
9. What is a useful purpose of PowerShell remoting controls?
A. Limiting who can run remote commands and what they are allowed to do
B. Hiding all administrative activity
C. Bypassing authentication
D. Disabling auditability
10. Why should logs avoid sensitive data?
A. Logs are always private
B. Logs may be widely stored, searched, retained, or accessed during operations
C. Logs should contain every password for debugging
D. Logging secrets improves incident response
11. What is the difference between terminating and non-terminating errors at a high level?
A. All PowerShell errors stop execution
B. No PowerShell errors can be handled
C. Some errors stop execution, while others report a problem but allow execution to continue
D. Error behavior has no effect on automation safety
12. What can PSScriptAnalyzer support?
A. Password recovery
B. Automatic authorization approval
C. Secret rotation by itself
D. Static review of PowerShell scripts for style, quality, and potential issues
13. What can Pester support?
A. Testing PowerShell code behavior
B. Encrypting transcripts
C. Replacing all code review
D. Disabling errors
14. Why is WhatIf support useful where appropriate?
A. It guarantees no bug exists
B. It can show intended changes before applying them
C. It replaces authorization
D. It disables logging
15. Which statement best summarizes secure PowerShell scripting?
A. Run every script as administrator
B. Store credentials in source code for convenience
C. Build scripts with validated input, safe command construction, protected secrets, least privilege, logging, testing, and clear operational boundaries
D. Use string-built commands whenever possible
Submit Quiz
Previous