Change Node Name through Code or Command

This topic contains 1 reply, has 2 voices, and was last updated by  Daniel Krebs 3 years, 9 months ago.

  • Author
  • #19660

    mayuri naware

    Is there any way to have the node name in configuration data file to be changed through program or and command. Actually I am creating DSC scripts and after that I am provisioning a new VM so till the Vm is created I dont know the node name and my DSC scripts are copied there and then they needs to be run, so I want to change the node name automatically in Configuration data after VM is created.

    Thanks in advance 🙂

  • #19661

    Daniel Krebs

    If your configuration script takes the node name as parameter you can specify any name necessary to generate the MOF document.

    Configuration Example
        [String] $NodeName
      Node $NodeName
        # ...
    Example -NodeName HelloWorld
    # Will generate HelloWorld.mof
    Example -NodeName 4d383c33-aefe-422b-8329-b2b0544fd958
    # Will generate 4d383c33-aefe-422b-8329-b2b0544fd958.mof

You must be logged in to reply to this topic.