Welcome!

Microsoft Cloud Authors: Janakiram MSV, Yeshim Deniz, David H Deans, 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
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, will discuss how they b...
SYS-CON Events announced today that Avere Systems, a leading provider of hybrid cloud enablement solutions, 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. Avere Systems was created by file systems experts determined to reinvent storage by changing the way enterprises thought about and bought storage resources. With decades of experience behind the company’s founders, Avere got its ...
SYS-CON Events announced today that Avere Systems, a leading provider of enterprise storage for the hybrid cloud, 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. Avere delivers a more modern architectural approach to storage that doesn't require the overprovisioning of storage capacity to achieve performance, overspending on expensive storage media for inactive data or the overbui...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, will discuss how from store operations...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
High-velocity engineering teams are applying not only continuous delivery processes, but also lessons in experimentation from established leaders like Amazon, Netflix, and Facebook. These companies have made experimentation a foundation for their release processes, allowing them to try out major feature releases and redesigns within smaller groups before making them broadly available. In his session at 21st Cloud Expo, Brian Lucas, Senior Staff Engineer at Optimizely, will discuss how by using...
In this strange new world where more and more power is drawn from business technology, companies are effectively straddling two paths on the road to innovation and transformation into digital enterprises. The first path is the heritage trail – with “legacy” technology forming the background. Here, extant technologies are transformed by core IT teams to provide more API-driven approaches. Legacy systems can restrict companies that are transitioning into digital enterprises. To truly become a lead...
SYS-CON Events announced today that Daiya Industry will exhibit at the Japanese Pavilion 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. Ruby Development Inc. builds new services in short period of time and provides a continuous support of those services based on Ruby on Rails. For more information, please visit https://github.com/RubyDevInc.
SYS-CON Events announced today that CAST Software 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. CAST was founded more than 25 years ago to make the invisible visible. Built around the idea that even the best analytics on the market still leave blind spots for technical teams looking to deliver better software and prevent outages, CAST provides the software intelligence that matter ...
As businesses evolve, they need technology that is simple to help them succeed today and flexible enough to help them build for tomorrow. Chrome is fit for the workplace of the future — providing a secure, consistent user experience across a range of devices that can be used anywhere. In her session at 21st Cloud Expo, Vidya Nagarajan, a Senior Product Manager at Google, will take a look at various options as to how ChromeOS can be leveraged to interact with people on the devices, and formats th...
SYS-CON Events announced today that Yuasa System will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Yuasa System is introducing a multi-purpose endurance testing system for flexible displays, OLED devices, flexible substrates, flat cables, and films in smartphones, wearables, automobiles, and healthcare.
SYS-CON Events announced today that Dasher Technologies 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. Dasher Technologies, Inc. ® is a premier IT solution provider that delivers expert technical resources along with trusted account executives to architect and deliver complete IT solutions and services to help our clients execute their goals, plans and objectives. Since 1999, we'v...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities – ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups. As a result, many firms employ new business models that place enormous impor...
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, 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. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that Taica will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. Taica manufacturers Alpha-GEL brand silicone components and materials, which maintain outstanding performance over a wide temperature range -40C to +200C. For more information, visit http://www.taica.co.jp/english/.
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, 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. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion 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. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that TidalScale 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. TidalScale is the leading provider of Software-Defined Servers that bring flexibility to modern data centers by right-sizing servers on the fly to fit any data set or workload. TidalScale’s award-winning inverse hypervisor technology combines multiple commodity servers (including their ass...
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...