powershell sharepoint 2013

I am trying to activate SharePoint 2013 service application in 5 servers, for example if I want to activate managed data service application in 5 servers at the same time.
How to do it with powershell,  am try following with no luck.

Powershell script:
#Registers domain accounts as SharePoint 2013 Managed Accounts.
$configLocation = "C:\temp\TestMMData.xml"
 [xml]$configXml = Get-Content $configLocation
$ActivateServers = $ConfigXml.Configuration.MMDataSvc.ServerstoActivate
Write-Output "ActivateServers" $ActivateServers

Open in new window


XML config file:
<Configuration>
<MMDataSvc>
<SvcAppName>Managed Metadata Service</SvcAppName>
<SvcName>Managed Metadata Web service</SvcName>
<DBName>Enter Database Name here</DBName>
<AppPoolName>Enter Application pool name for Managed Metadata here</AppPoolName>
<AppPoolAcct> Enter Apppool account name here</AppPoolAcct>
<ServerstoActivate>
	<App1>Application1 Server Name</App1>
	<App2>Application2 Server Name</App2>
	<Wfe1>Wfe1 Server Name </Wfe1>
	<Wfe2>Wfe2 Server Name</Wfe2>
	<Wfe3>Wfe3 Server Name</Wfe3>
</ServerstoActivate>
</MMDataSvc>
</Configuration>

Open in new window

dkumeriAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
could you please explain/confirm: you want to simply start Managed Metadata Service on the five servers?

Your XML config file is not properly structured as you have not the same node for each server. It should more look like
<Configuration>
<MMDataSvc>
<SvcAppName>Managed Metadata Service</SvcAppName>
<SvcName>Managed Metadata Web service</SvcName>
<DBName>Enter Database Name here</DBName>
<AppPoolName>Enter Application pool name for Managed Metadata here</AppPoolName>
<AppPoolAcct> Enter Apppool account name here</AppPoolAcct>
<ServerstoActivate>
	<Server servertype="APP" serverno="1">Application1 Server Name</Server>
	<Server servertype="APP" serverno="2">Application2 Server Name</Server>
	<Server servertype="WFE" serverno="1">Wfe1 Server Name</Server>
	<Server servertype="WFE" serverno="2">Wfe2 Server Name</Server>
	<Server servertype="WFE" serverno="3">Wfe3 Server Name</Server>
</ServerstoActivate>
</MMDataSvc>
</Configuration>

Open in new window


Then you should be able to loop through the servers with a foreach like
foreach ($server in $ServerstoActivate)

{
Get-SpServiceInstance -Server $server |?{$_.TypeName -eq "Managed MetaData Web Service"} | Start-SPServiceInstance

} 

Open in new window


HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dkumeriAuthor Commented:
good one
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.