Author Posts

January 11, 2018 at 6:22 am

Hello, i have a scenario where i have about 5000 servers. I can't write configuration data for each server mentioning its name, is there a way that we can get the hostnames from a textfile and place them in a variable such that it will generate the .mof files for them?

Best regards
Charan

January 11, 2018 at 10:11 am

If all servers are using the exact same config, you can use something like this:

Configuration Example
{
  Node localhost 
  {
    #whatever config you need
  } 
}

Otherwise, look at using configuration data instead

January 11, 2018 at 12:04 pm

In push model, how can we use localhost? Pull supports this type of config.

Can you give me an example of config data to include all hosts, really appreciate your help.

Thanks
Charan

January 12, 2018 at 6:15 pm

I think there might be some confusion here. Push mode basically a decentralized scenario where you have servers without a "management server" per say; kind of standalone. Pull mode, you have centralized scenario where configurations are published in the Pull servers and clients check in every x amount of minutes. Which one of the two scenarios are you? and what are the differences between server to server?

January 12, 2018 at 6:56 pm

Hi Pereyra,

Thanks for your reply, i am looking for push mode, but in push mode if we create a config document we need to pass hostname for node parameter right? If i have 1000+ hosts, how can i give all host names in that doc? Instead can we use a variable to get host names from a text file?

Regards
Charan

January 15, 2018 at 11:25 pm

You could create a configuration like this:

Configuration MyApplication
{
  param (
    [String]$MachineName
  )

  Node ($MachineName)
  {
    #Some config here
  }
}

And also, I haven't tried it but Start-DscConfiguration has a -ComputerName parameter for which, I would assume, you can just use it in conjuction with a config for localhost.