How to push mof to multiple nodes using a variable

Welcome Forums DSC (Desired State Configuration) How to push mof to multiple nodes using a variable

This topic contains 5 replies, has 2 voices, and was last updated by

 
Participant
10 months ago.

  • Author
    Posts
  • #91216

    Participant
    Points: 0
    Rank: Member

    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

  • #91220

    Participant
    Points: 22
    Rank: Member

    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

    • #91223

      Participant
      Points: 0
      Rank: Member

      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

  • #91312

    Participant
    Points: 22
    Rank: Member

    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?

    • #91313

      Participant
      Points: 0
      Rank: Member

      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

  • #91544

    Participant
    Points: 22
    Rank: Member

    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.

The topic ‘How to push mof to multiple nodes using a variable’ is closed to new replies.