A systems administrator is tasked with writing a single script to perform two functions: create new user objects in an on-premises Active Directory domain and provision virtual machines on a Hyper-V host cluster. A key requirement is that the script must execute unchanged on both Windows Server 2022 and Ubuntu Server 22.04 hosts, which already have the necessary management modules installed. To simplify data handling, the administrator also wants a pipeline that passes structured objects instead of plain-text streams.
Which scripting language best satisfies all of these requirements?
PowerShell 7 (also called PowerShell Core or pwsh) runs natively on Windows, Linux, and macOS, so a single script can be executed on both Windows Server 2022 and Ubuntu 22.04. Its object-based pipeline passes .NET objects between commands instead of raw text, greatly reducing parsing effort. On Windows, it can load the built-in Hyper-V module and the ActiveDirectory module, giving the script direct access to cmdlets such as New-ADUser and New-VM. From a Linux host, PowerShell's remoting features can be used to execute the same commands on the remote Windows servers. Bash, Windows batch files, and VBScript cannot meet all of these cross-platform and management-module requirements, and their pipelines (if any) are text-based only.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why is PowerShell Core (pwsh) suitable for cross-platform scripting?
Open an interactive chat with Bash
What is the advantage of an object-based pipeline in PowerShell?
Open an interactive chat with Bash
How does PowerShell support managing Active Directory and Hyper-V?