Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Which cmdlet converts a JSON-formatted string into PowerShell objects?
Not quite. Try another option.
Answer: ConvertFrom-Json
ConvertFrom-Json converts JSON text into PowerShell objects.
Question 5 of 60 · Menus · Easy
What is a common purpose of a menu in a PowerShell script?
Not quite. Try another option.
Answer: To select an action
A menu allows the user to choose which action the script should perform.
Question 6 of 60 · Prompts · Easy
Which cmdlet prompts a user to enter text in the console?
Not quite. Try another option.
Answer: Read-Host
Read-Host displays a prompt and accepts input from the user.
Question 7 of 60 · System tasks (services, processes, registry, tasks) · Easy
Which cmdlet displays processes running on a computer?
Not quite. Try another option.
Answer: Get-Process
Get-Process retrieves information about running processes.
Question 8 of 60 · System tasks (services, processes, registry, tasks) · Easy
Which cmdlet starts a stopped Windows service?
Not quite. Try another option.
Answer: Start-Service
Start-Service sends a start command to a Windows service.
Question 9 of 60 · Active Directory · Easy
Which PowerShell cmdlet retrieves an Active Directory user account?
Not quite. Try another option.
Answer: Get-ADUser
Get-ADUser retrieves one or more user accounts from Active Directory.
Question 10 of 60 · Active Directory · Easy
Which PowerShell module commonly provides cmdlets such as Get-ADUser?
Not quite. Try another option.
Answer: ActiveDirectory
The ActiveDirectory module provides cmdlets for managing Active Directory objects.
Question 11 of 60 · PowerShell Remoting · Easy
Which cmdlet runs a command on one or more remote computers?
Not quite. Try another option.
Answer: Invoke-Command
Invoke-Command executes commands on local or remote computers.
Question 12 of 60 · PowerShell Remoting · Easy
Which cmdlet starts an interactive PowerShell session with a remote computer?
Not quite. Try another option.
Answer: Enter-PSSession
Enter-PSSession opens an interactive session with a remote computer.
Question 13 of 60 · Jobs · Easy
Which cmdlet starts a PowerShell command as a background job?
Not quite. Try another option.
Answer: Start-Job
Start-Job runs a command in the background as a PowerShell job.
Question 14 of 60 · Jobs · Easy
Which cmdlet retrieves the results produced by a PowerShell background job?
Not quite. Try another option.
Answer: Receive-Job
Receive-Job obtains the output generated by a background job.
Question 15 of 60 · Scheduled tasks · Easy
What is the main purpose of a scheduled task?
Not quite. Try another option.
Answer: To run an action automatically
A scheduled task runs a program or script automatically at a configured time or event.
Question 16 of 60 · Advanced functions with validation · Easy
Which attribute restricts a PowerShell parameter to a predefined set of values?
Not quite. Try another option.
Answer: ValidateSet
ValidateSet accepts only values listed in the attribute.
Question 17 of 60 · GUI scripting · Easy
Which .NET technology can be used to create graphical interfaces in PowerShell?
Not quite. Try another option.
Answer: Windows Forms
PowerShell can use Windows Forms classes to create windows, buttons, labels, and other controls.
Question 18 of 60 · Automation scripts for user management · Easy
Why might a user-management script read account details from a CSV file?
Not quite. Try another option.
Answer: To process many accounts
A CSV file can hold details for many users, allowing a script to process accounts in bulk.
Question 19 of 60 · Log automation · Easy
Which cmdlet retrieves entries from Windows event logs?
Not quite. Try another option.
Answer: Get-WinEvent
Get-WinEvent retrieves events from Windows event logs and event tracing log files.
Question 20 of 60 · System monitoring · Easy
What is the purpose of a basic system-monitoring script?
Not quite. Try another option.
Answer: To track system health
A monitoring script checks information such as CPU, memory, disk, process, or service status.
Question 21 of 60 · Modules · Medium
A script requires the ActiveDirectory module. Which command should be used at the beginning of the script to load the module and stop execution if loading fails?
Import-Csv converts each row into an object whose columns are properties, allowing Where-Object to filter the Enabled property.
Question 23 of 60 · File handling (CSV, JSON, XML) · Medium
A nested PowerShell object is being saved as JSON, but properties below the second level are replaced with abbreviated output. Which command best preserves six levels of nested data?
ConvertTo-Json -Depth 6 serializes nested properties through six levels before Set-Content writes the JSON text.
Question 24 of 60 · File handling (CSV, JSON, XML) · Medium
An XML configuration file contains <server enabled="true">APP01</server> inside a <servers> element. After loading it with [xml]$config = Get-Content ./config.xml, which expression selects only enabled server nodes?
Invoke-Command runs a script block on one or more remote computers and automatically uses temporary remoting connections.
Question 31 of 60 · PowerShell Remoting · Medium
A script runs several commands repeatedly on the same remote computer. Which approach avoids creating a new remote connection for every command?
Not quite. Try another option.
Answer: Create a PSSession and pass it with -Session
A reusable PSSession maintains the remote connection and can be supplied to repeated Invoke-Command calls.
Question 32 of 60 · Jobs · Medium
A background job has completed, and its output must be collected while keeping the job available for later inspection. Which command should be used?
Not quite. Try another option.
Answer: Receive-Job -Job $job -Keep
Receive-Job retrieves job output, and -Keep prevents that output from being removed from the job's output store.
Question 33 of 60 · Scheduled tasks · Medium
A PowerShell script must run daily at 2:00 AM under the SYSTEM account. Which set of objects is required before calling Register-ScheduledTask?
Not quite. Try another option.
Answer: A task action, a daily trigger, and a SYSTEM principal
A scheduled task needs an action defining what runs, a trigger defining when it runs, and a principal defining the execution identity.
Question 34 of 60 · Advanced functions with validation · Medium
An advanced function parameter named Environment must accept only Dev, Test, or Prod. Which declaration enforces this rule before the function body runs?
ValidateSet restricts a parameter to a predefined collection of allowed values and rejects other input during parameter binding.
Question 35 of 60 · Advanced functions with validation · Medium
A function accepts server names from the pipeline by property name. Which parameter attribute enables objects with a ComputerName property to bind automatically?
Add_Click registers the supplied script block as an event handler for the button's Click event.
Question 37 of 60 · Automation scripts for user management · Medium
A user-provisioning script imports employee records from CSV. Which design best prevents duplicate Active Directory accounts when the script is run again?
Not quite. Try another option.
Answer: Check for each account before calling New-ADUser
Checking whether the account already exists makes the provisioning operation repeatable and avoids duplicate-account creation errors.
Question 38 of 60 · Log automation · Medium
A log-maintenance script must archive .log files older than 30 days. Which filter correctly identifies the files?
A file is older than 30 days when its LastWriteTime is earlier than the date calculated by AddDays(-30).
Question 39 of 60 · System monitoring · Medium
A monitoring script samples processor usage and must alert when the average PercentProcessorTime value exceeds 80. Which approach correctly calculates the average from $samples?
Measure-Object -Average calculates the mean of the specified numeric property, and its Average property contains the result.
Question 40 of 60 · Deployment tasks · Medium
A deployment script installs an MSI package silently and must wait for installation to finish before verifying the application. Which command is most appropriate?
Start-Process launches msiexec.exe with silent-install arguments, and -Wait pauses the script until installation completes.
Question 41 of 60 · Modules · Hard
A script module defines Get-Report, New-Report, and Remove-Report. The .psm1 file calls Export-ModuleMember -Function Get-Report,New-Report, while the manifest specifies FunctionsToExport = @('Get-Report','Remove-Report'). Which functions are exported when the manifest is imported?
Not quite. Try another option.
Answer: Only Get-Report
The manifest can further restrict exports but cannot export a function excluded by Export-ModuleMember. Only Get-Report appears in both export lists.
Question 42 of 60 · Modules · Hard
A server has versions 2.1.0 and 3.0.0 of Contoso.Tools installed. A script must load at least version 2.0.0 but must never load version 3.0.0 or later. Which command enforces that requirement?
MinimumVersion and MaximumVersion define an allowed range. RequiredVersion demands an exact installed version and cannot be combined to express this range.
Question 43 of 60 · File handling (CSV, JSON, XML) · Hard
A PowerShell object contains nested properties five levels deep. After ConvertTo-Json and ConvertFrom-Json, properties below the default serialization depth are missing or represented incompletely. Which change directly addresses the problem?
Not quite. Try another option.
Answer: Call ConvertTo-Json -Depth 6 before writing
ConvertTo-Json limits nested serialization according to -Depth. Setting a sufficient depth preserves the nested data; compression only changes whitespace.
Question 44 of 60 · File handling (CSV, JSON, XML) · Hard
An XML document uses <d:server> elements under the namespace URI urn:datacenter. Why does Select-Xml -Xml $xml -XPath '//server' return no nodes, and what is the correct approach?
Not quite. Try another option.
Answer: XPath must use a registered prefix mapped to urn:datacenter
Namespace-qualified elements are not matched by an unqualified XPath name. Pass a namespace map, such as @{ d = 'urn:datacenter' }, and query //d:server.
Question 45 of 60 · Menus · Hard
A console menu accepts choices 1 through 4. It must reject 2abc, whitespace, and out-of-range integers without throwing an exception. Which validation design is most robust?
Not quite. Try another option.
Answer: Use [int]::TryParse() and then test the parsed range
TryParse safely verifies the entire numeric input, and a separate range check enforces valid menu choices. The regex shown would also match invalid strings such as 2abc.
Question 46 of 60 · Prompts · Hard
An automation script must prompt interactively for credentials and pass them to Invoke-Command without storing the password as plain text in a variable. Which approach is appropriate?
Not quite. Try another option.
Answer: Use Get-Credential and pass the resulting PSCredential
Get-Credential returns a PSCredential containing a SecureString password and can be supplied directly to commands that accept credentials.
Question 47 of 60 · System tasks (services, processes, registry, tasks) · Hard
A 64-bit machine has different values in the 32-bit and 64-bit registry views. A 32-bit PowerShell process must reliably modify the 64-bit HKLM\Software view. Which technique is correct?
Not quite. Try another option.
Answer: Open LocalMachine with Registry64 through Microsoft.Win32.RegistryKey
The .NET registry API can explicitly select RegistryView.Registry64. The registry provider normally follows the bitness and registry view of the current process.
Question 48 of 60 · System tasks (services, processes, registry, tasks) · Hard
A script locates a process, waits several seconds, and then stops it. Process IDs can be reused during that interval. Which design best reduces the risk of stopping a different process?
Not quite. Try another option.
Answer: Retain the process object and verify its StartTime before stopping
A PID alone can identify a later process after reuse. Comparing identity-related data such as PID and StartTime immediately before termination reduces that race.
Question 49 of 60 · Active Directory · Hard
A provisioning script may be rerun after partial failure. It must add a user to a group without failing when the user is already a member. Which pattern is most idempotent?
Not quite. Try another option.
Answer: Test current membership and add the user only when absent
Checking the desired state before changing it makes repeated runs converge safely. Suppressing all errors can hide permission, connectivity, and directory failures.
Question 50 of 60 · Active Directory · Hard
A script must find enabled users under one organizational unit whose Department equals the value in $department, while allowing the domain controller to perform the filtering. Which approach is appropriate?
Not quite. Try another option.
Answer: Use Get-ADUser -Filter with -SearchBase and request needed properties
-Filter and -SearchBase constrain the query on the directory server. This avoids retrieving the full domain and then filtering client-side.
Question 51 of 60 · PowerShell Remoting · Hard
After Invoke-Command -ComputerName Server1 { Get-Service BITS }, the returned object is labeled Deserialized.System.ServiceProcess.ServiceController, and its service-control methods are unavailable. What explains this behavior?
Not quite. Try another option.
Answer: Remoting serializes object data, so instance methods are not preserved
Standard remoting returns serialized snapshots rather than live remote objects. Run actions such as Restart-Service inside the remote script block.
Question 52 of 60 · PowerShell Remoting · Hard
From workstation A, an administrator remotes to server B. A command on B then attempts to access a protected file share on server C using the administrator's credentials and receives access denied. Which remoting issue is most likely?
Not quite. Try another option.
Answer: The second hop cannot delegate the user's credentials by default
This is the second-hop problem: credentials used from A to B are not automatically delegated from B to C. Use an approved delegation design such as resource-based Kerberos constrained delegation.
Question 53 of 60 · Jobs · Hard
A script calls Receive-Job $job once for an interim status display and later calls it again after completion, but the first batch of output is missing from the final collection. Which change preserves previously received output?
Not quite. Try another option.
Answer: Use Receive-Job $job -Keep for the interim read
Receive-Job removes received output from the job's output buffer by default. -Keep returns the data while retaining it for later retrieval.
Question 54 of 60 · Scheduled tasks · Hard
A scheduled PowerShell task must run on a server after reboot even when no user is signed in. It requires elevated local privileges and must not depend on an interactive desktop. Which configuration best meets these requirements?
Not quite. Try another option.
Answer: Run as SYSTEM with RunLevel Highest and a startup trigger
A startup trigger runs after boot, and SYSTEM can run without an interactive logon. RunLevel Highest requests the elevated execution level.
Question 55 of 60 · Advanced functions with validation · Hard
An advanced function accepts server names from the pipeline both by value and by property name. It should collect input in process and perform one batched API call after all pipeline input arrives. Where should the API call be placed?
Not quite. Try another option.
Answer: In end, using values accumulated during process
process handles each pipeline item, while end runs once after input is exhausted. Accumulating in process and submitting in end enables batching.
Question 56 of 60 · Advanced functions with validation · Hard
A function parameter must accept only existing leaf files. The function also accepts pipeline input, and validation must occur during parameter binding. Which declaration is most suitable?
ValidateScript can test each bound value with Test-Path. Specifying -PathType Leaf rejects directories while allowing only existing file paths.
Question 57 of 60 · GUI scripting · Hard
A WPF PowerShell tool starts a long-running scan directly in a button click handler, causing the window to freeze. Which architecture keeps the interface responsive and updates controls safely?
Not quite. Try another option.
Answer: Run the scan in another runspace and marshal updates through the UI dispatcher
Long work should run off the UI thread. WPF controls have thread affinity, so updates must be dispatched back to the UI thread.
Question 58 of 60 · Automation scripts for user management · Hard
A bulk user-creation script reads a CSV and may stop halfway because of a transient directory failure. Which design most safely supports rerunning the same file?
Not quite. Try another option.
Answer: Derive stable identities, compare desired state, and update only differences
Stable identity and desired-state comparison make the operation idempotent. Completed rows remain correct, and reruns can create or update only what is missing.
Question 59 of 60 · Log automation · Hard
A script polls a growing text log every minute. It must avoid rereading old lines and must also handle log rotation, where the replacement file can be smaller than the previous file. What state should it persist?
Not quite. Try another option.
Answer: A file identity plus byte offset, resetting when identity or length changes
The offset supports incremental reads, while file identity and length checks detect replacement or truncation. Timestamps and line text may be duplicated or reordered.
Question 60 of 60 · System monitoring · Hard
A monitoring script computes CPU utilization from a cumulative processor-time counter sampled at times and . On an -logical-processor system, which expression gives normalized utilization as a percentage?
Not quite. Try another option.
Answer:
The increase in cumulative CPU time is divided by elapsed wall time and processor count. Multiplying by 100 converts the normalized fraction to a percentage.
That's unit 6
Answer a few questions and your score shows up here.
Nearly through. Did unit 6 of CSC104 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 6 of CSC104 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.