Learn various ways to interact with Windows Admin Center by using PowerShell.

Timothy Warner

Timothy Warner is a Microsoft Cloud and Datacenter Management Most Valuable Professional (MVP) who is based in Nashville, TN. Check out his Azure and Windows Server video training at Pluralsight, and feel free to reach out to Tim via Twitter.

Latest posts by Timothy Warner (see all)

Are you using Windows Admin Center (WAC) yet? If not, why not? This free Microsoft web-based utility represents the next generation of on-premises and cloud server management! Here, look:

Windows Admin Center

Windows Admin Center

The more recent WAC builds offer much more robust PowerShell support. And some PowerShell community members, chief among them Microsoft MVP Ravi Chaganti, develop useful PowerShell extensions to WAC's core functionality. Let's get started!

WAC and PowerShell DSC ^

You may want to require installation of WAC on some of your infrastructure servers. Why not enlist PowerShell Desired State Configuration (DSC) to assist you enforce this requirement?

The aforementioned Ravi Chaganti wrote a DSC resource module that, among other things, installs WAC on one or more nodes. You'll need to load Ravi's resources, download the WAC MSI package (easily done with a call to http://aka.ms/WACDownload), and place the file in a known location. After that, you can then write a configuration script similar to the following sample I ran on my test system (here's a link to the module docs):

Other programmatic WAC installation methods ^

Microsoft keeps the current WAC version on the public Chocolatey package gallery. Therefore, you can use the native choco client or the PowerShell PackageManagement commands to install the software.

Use choco:

Alternatively, use PowerShell:

My friend and fellow 4sysops author Adam Bertram wrote a nice tutorial on installing WAC on Server Core systems. The long story short here is Adam uses the controversial Invoke-WebRequest cmdlet to fetch the WAC .msi file and then the msiexec command-line utility to orchestrate the installation.

WAC built-in utility scripts ^

Microsoft added "Show PowerShell" support in version 1806. If you didn't already know, WAC is largely a web-based front-end to a PowerShell function script library.

From any page in WAC, click View PowerShell scripts from the top toolbar to browse the script library; I show you this in the next figure.

WAC has a built in PowerShell function library

WAC has a built in PowerShell function library

Some of these functions might be useful to you outside of WAC. Simply choose a script from the drop-down, Ctrl+A to select all, and then Ctrl+C to copy the source code for Ctrl+V-ing into your development environment.

The PowerShell functions all deal in central Windows administration tasks, including:

  • Querying system hardware and software
  • Retrieving Hyper-V host and guest metadata
  • Obtaining Windows Server failover cluster information
  • Generating server inventories

Several contributors took the time to copy all the WAC functions and store them in a centrally cloneable GitHub repository; here is Paul DiMaggio's repo for your consideration. Note that Paul's repo is out-of-date—perhaps you could submit a pull request to Paul with the newest WAC functions?

PowerShell-based WAC management ^

WAC version 1812 added PowerShell support to manage WAC connections and extension feeds. Again, Ravi immediately "went there" by creating his PSWindowsAdminCenter module, available at the PowerShell Gallery. Let's install the module and view its enclosed functions:

Let's see what we can do with Ravi's functions. Make sure to study the documentation as well.

First, we'll connect to a WAC host:

Second, we can retrieve connection details:

Third, we can get a list of all installed extensions from WAC:

Last, we can install a new extension:

Hopefully you see how potentially useful Ravi's PSWindowsAdminCenter module is. With it you can automate WAC connection (standalone and cluster) and extension/feed management.

Recently I learned that WAC Preview includes a PowerShell module that makes it simple to bulk export and import your connections. Here's the reference, and here's the code:

WAC internal PowerShell console ^

Last but not least, I thought I'd mention that WAC has a built-in PowerShell console host. This is terrific news because it means we can leverage PowerShell management from anywhere in the world given we have (a) a web browser and (b) a secure connection to a WAC host.

WAC has its own PowerShell console

WAC has its own PowerShell console

Once you're at a PowerShell prompt, you can manage local and remote systems equally easily.

In summary, I hope I've given you more to think about in terms of interacting with WAC with PowerShell. After all, WAC is largely a PowerShell host application!

Join the 4sysops PowerShell group!

3+

Users who have LIKED this post:

  • avatar
  • avatar
Share
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account