Welcome!

Microsoft Cloud Authors: David H Deans, Yeshim Deniz, Janakiram MSV, Andreas Grabner, Stackify Blog

Related Topics: Microsoft Cloud, Industrial IoT, Microservices Expo, Open Source Cloud, Containers Expo Blog, Silverlight, Cloud Security

Microsoft Cloud: Blog Post

Use PowerShell to Add New Managed Servers in Windows Server 2012

PowerShell 3.0 in Windows Server 2012 provides automated management

When I’m speaking with IT Pros about the great multi-server management enhancements in Windows Server 2012, I’m frequently asked about ways in which servers can be programmatically added to the new Server Manager tool.  This can be very useful when building many new servers and you’d like to make sure they are all added into the Server Manager console in an automated fashion.  In this article, we’ll step through the method of doing exactly this with PowerShell 3.0 and Server Manager together.

image

Where does Server Manager store its list of Managed Servers?
Before we can programmatically add new servers to the list of managed servers in Server Manager, we first need to understand how Server Manager stores the list of servers it is managing.   When adding servers to Server Manager, the name of each managed server is stored in the following XML configuration file:

C:\Users\[Username]\AppData\Roaming\Microsoft\Windows\ServerManager\ServerList.xml

Since this XML file is stored inside each user’s profile in the “Roaming” folder, by default this file will roam across management workstations if roaming user profiles are configured via Active Directory.

This XML file has a very simple structure consisting of a top-level ServerList node with child ServerInfo elements for individual servers, child ServerGroupInfo elements for custom groups that have been added to Server Manager, and child ServerGroupMembership elements for members of each custom group.

image

Sample ServerList.xml Configuration File

Thankfully, XML files can be easily processed by PowerShell 3.0 and we’ll use this capability to programmatically add new servers into the list of managed servers for Server Manager.

Getting Started …
To work through these steps together, you’ll need Windows Server 2012 to be already installed and accessible.  If you don’t yet have a lab environment running Windows Server 2012, check out our “Early Experts” program for some really easy methods to build a Windows Server 2012 lab in your on-premises environment or in the cloud using Windows Azure Infrastructure Services.

Step 1 - Close Server Manager before updating ServerList.xml
When Server Manager is running, it is continuously reading and writing information to the ServerList.xml file.  When updating this file outside of the Server Manager tool, you’ll want to make sure Server Manager is closed so that it’s not reading and writing to this file at the same time as your own updates.

To programmatically close Server Manager in your PowerShell script prior to making any updates to the ServerList.xml file, use the following PowerShell code:

get-process ServerManager | stop-process –force

Step 2 – Set path of existing ServerList.xml file
The ServerList.xml file is located in a rather lengthy path that is stored on a per-user basis.  Let’s set a variable to make it easy to reference the path to this file in our PowerShell script.

$file = get-item "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\ ServerManager\ServerList.xml"

Step 3 – Backup ServerList.xml
Improper direct modification of ServerList.xml can render this file unusable by Server Manager, so be sure to make a backup copy of this file before proceeding.

copy-item –path $file –destination $file-backup –force

Step 4 – Get content from ServerList.xml file in XML format
Next, we’ll grab the XML content from the ServerList.xml and store it in a PowerShell variable using the get-content cmdlet.

$xml = [xml] (get-content $file )

Step 5 – Clone an existing managed server element to a new XML element
Using the PowerShell clone() method for an existing XML element, we can create a new ServerInfo element that we can then update with the unique values for our new managed server entry in Server Manager.

$newserver = @($xml.ServerList.ServerInfo)[0].clone()

Step 6 – Update the new cloned element with new server information
Once we’ve cloned a new ServerInfo element, we can then easily update the new element to include the information that is related to our new managed server entry in Server Manager.

$newserver.name = “servername.domain.com”

$newserver.lastUpdateTime = “0001-01-01T00:00:00”

$newserver.status = “2”

Step 7 – Append the new cloned element inside the ServerList node
The new cloned element is now updated to reflect our new server information, so we’ll now append this cloned element to the existing list of servers stored inside the ServerList node that we previously read from ServerList.xml.

$xml.ServerList.AppendChild($newserver)

Step 8 – Save the updated XML elements to ServerList.xml
After appending the new ServerInfo element inside the ServerList node, we’ll commit the changes to the ServerList.xml file using the PowerShell save()method.

$xml.Save($file.FullName)

Step 9 – Re-launch Server Manager to see the results
We’ve completed the process to add a new managed server to the ServerList.xml file.  Now, let’s re-launch Server Manager so that we can see our results.

start-process –filepath $env:SystemRoot\System32\ServerManager.exe –WindowStyle Maximized

Completed! What’s Next?
Continue learning about all of the great new end-to-end enhancements in Windows Server 2012, Server Manager and PowerShell 3.0 by joining our FREE “Early Experts” online study group.  You can be our next “Early Expert”!

WS2012EE-Apprentice-Sample

You can be our next “Early Expert”!

More Stories By Keith Mayer

Keith Mayer is a Technical Evangelist at Microsoft focused on Windows Infrastructure, Data Center Virtualization, Systems Management and Private Cloud. Keith has over 17 years of experience as a technical leader of complex IT projects, in diverse roles, such as Network Engineer, IT Manager, Technical Instructor and Consultant. He has consulted and trained thousands of IT professionals worldwide on the design and implementation of enterprise technology solutions.

Keith is currently certified on several Microsoft technologies, including System Center, Hyper-V, Windows, Windows Server, SharePoint and Exchange. He also holds other industry certifications from IBM, Cisco, Citrix, HP, CheckPoint, CompTIA and Interwoven.

Keith is the author of the IT Pros ROCK! Blog on Microsoft TechNet, voted as one of the Top 50 "Must Read" IT Blogs.

Keith also manages the Windows Server 2012 "Early Experts" Challenge - a FREE online study group for IT Pros interested in studying and preparing for certification on Windows Server 2012. Join us and become the next "Early Expert"!

@ThingsExpo Stories
IoT is at the core or many Digital Transformation initiatives with the goal of re-inventing a company's business model. We all agree that collecting relevant IoT data will result in massive amounts of data needing to be stored. However, with the rapid development of IoT devices and ongoing business model transformation, we are not able to predict the volume and growth of IoT data. And with the lack of IoT history, traditional methods of IT and infrastructure planning based on the past do not app...
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Consumers increasingly expect their electronic "things" to be connected to smart phones, tablets and the Internet. When that thing happens to be a medical device, the risks and benefits of connectivity must be carefully weighed. Once the decision is made that connecting the device is beneficial, medical device manufacturers must design their products to maintain patient safety and prevent compromised personal health information in the face of cybersecurity threats. In his session at @ThingsExpo...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
SYS-CON Events announced today that Grape Up will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company specializing in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the U.S. and Europe, Grape Up works with a variety of customers from emergi...
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
In the enterprise today, connected IoT devices are everywhere – both inside and outside corporate environments. The need to identify, manage, control and secure a quickly growing web of connections and outside devices is making the already challenging task of security even more important, and onerous. In his session at @ThingsExpo, Rich Boyer, CISO and Chief Architect for Security at NTT i3, discussed new ways of thinking and the approaches needed to address the emerging challenges of security i...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
From 2013, NTT Communications has been providing cPaaS service, SkyWay. Its customer’s expectations for leveraging WebRTC technology are not only typical real-time communication use cases such as Web conference, remote education, but also IoT use cases such as remote camera monitoring, smart-glass, and robotic. Because of this, NTT Communications has numerous IoT business use-cases that its customers are developing on top of PaaS. WebRTC will lead IoT businesses to be more innovative and address...
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
In his opening keynote at 20th Cloud Expo, Michael Maximilien, Research Scientist, Architect, and Engineer at IBM, discussed the full potential of the cloud and social data requires artificial intelligence. By mixing Cloud Foundry and the rich set of Watson services, IBM's Bluemix is the best cloud operating system for enterprises today, providing rapid development and deployment of applications that can take advantage of the rich catalog of Watson services to help drive insights from the vast t...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
Recently, IoT seems emerging as a solution vehicle for data analytics on real-world scenarios from setting a room temperature setting to predicting a component failure of an aircraft. Compared with developing an application or deploying a cloud service, is an IoT solution unique? If so, how? How does a typical IoT solution architecture consist? And what are the essential components and how are they relevant to each other? How does the security play out? What are the best practices in formulating...
SYS-CON Events announced today that Elastifile will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Elastifile Cloud File System (ECFS) is software-defined data infrastructure designed for seamless and efficient management of dynamic workloads across heterogeneous environments. Elastifile provides the architecture needed to optimize your hybrid cloud environment, by facilitating efficient...