Work with Custom XML Data
Learn On Demand
Learn On Demand Pro Series

Time
45 minutes

The Work with Custom XML Data IT Pro Challenges hands-on experience teaches learners, familiar with some scripting, to create and import user accounts to an Azure platform. Networking Operations Specialist, Network Engineer, and System Administrator job roles advance their understanding of how to write and use XML code in Microsoft PowerShell.

Join over 2 million IT and cyber professionals advancing their careers

OR

Sign up with Google

Already have an account? Sign In »

Overview

Learners take account information structured into Extensible Markup Language (XML) output, export the data as a variable, and import the data contents to set-up user accounts. This 45-minute hands-on lab provides a virtual machine through Microsoft Azure, with PowerShell capabilities. Those running through the lab on a Mac need to ensure the availability of Microsoft Remote Desktop to complete the virtual lab.

XML structures information into a hierarchy using different tags and has flexibility in defining information. Where many databases and web applications structure output data using XML, System Administrators, Network Analysts, Network Operations Specialist, and Network Engineers need to be comforting exporting, manipulating, and using XML data through PowerShell commands and the PowerShell ISE scripting tool.

Instructions provide learners XML account data to analyze while demonstrating and advancing their PowerShell coding problem-solving capabilities to import automatically XML data. The learner may consult with guided hints, offered with each example, to supplement his or her programming skills. Upon completion of this lab, learners gain a foundation in handling and using XML data as a PowerShell Administrator.

Lab Set-Up:

This module has learners set-up the virtual lab environment hosted through a Microsoft Azure resource group. First, users log into the Azure platform and then launch the LabVM virtual system, as provisioned in Azure. Using the Remote Desktop Protocol (RDP), the learner signs into the remote computer with the PowerShell application to do the virtual lab exercises. Learners validate PowerShell works by creating a Class directory in the C drive and then changing to that directory.

Analyze the XML data:

Learners create an XML file, through the PowerShell ISE scripting tool, with the data provided in this exercise. The module has lab participants look over the script for attributes, each defined XML object, and the nodes, the first, last, address, and phone data that makes up each of the attributes. Through this analysis, learners gain an understanding of what the XML data to be imported means.

Import the XML data into Windows PowerShell:

This section of the lab takes the script created in the previous step and stores it as a variable, $XMLTest. Learners verify that the $XMLTest has the correct data by outputting the account nodes into the PowerShell window. Then the user runs a command to view the phone node.

Write a script to import the XML data and create accounts

In the lab section, learners write PowerShell ISE code to import the code automatically. The script accesses the XML data and loops through the contents so that each attribute or account gets added to the Azure resource group. The variables ($Name, $FullName, and $Description) stores and combines the XML nodes. The code assigns a default Password “Pa55w.rd” to each of the user accounts. The Powershell Program imports the accounts as a batch.

Summary:

Upon lab completion, learners understand how to analyze and understand the data in an Extensible Markup Language format. Learners know how to store XML contents in a PowerShell variable and to use the contents contained in this variable to import and create new user accounts.