How do I find the Guid (so I can run DSC configurations on remote hosts)?

This topic contains 3 replies, has 4 voices, and was last updated by Profile photo of Justin King Justin King 6 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36450
    Profile photo of Kiran
    Kiran
    Participant

    [guid]::NewGuid() is a poor method of obtaining the GUID. It reassigns the Guid. How can I reliably display it in one command without changing what it is? I don't want to query the A.D. server if I don't have to. I'm using PowerShell 4 on Windows Server 2012.

    #36451
    Profile photo of Don Jones
    Don Jones
    Keymaster

    I'm not sure I understand what you're after. NewGuid simply created a new globally unique identifier. AD doesn't play any role in DSC.

    Are you asking how to view the GUID assigned to a node?

    Thing is, I don't understand what this has to do with running configurations on remote hosts. So maybe I'm totally misunderstanding your question?

    #36455
    Profile photo of Arie H
    Arie H
    Participant

    Hi Kiran,

    The GUID of a node is set by the person running the LCM script for that node.
    The node doesnt come pre-configured with a GUID

    Some like to use [guid]::NewGuid to create a new on for each noe but that requires handling and managing those numbers in say a database.

    Some people that have AD just read the computer object ID which is a GUID and use that in ther script, so they have a function that queries AD for that spefic item in their scripts. Helps abit in the management.

    The first option is something people would use if they dont want to bind themselves to AD, whether they have it or not, as its not available for example for provisioning a server before it is being added to a domain for example.

    To have a node pull a configuration from a pull server, the Mof file on the pull server has to have a matching name as in {GUID}.mof.

    You can then use the same GUID for several servers if you want all of them to pull the same mof file for example. Something that DSC in P5 is a bit better in the allowing you more flexibility, so should recommenf upgrading if its an option.

    #36543
    Profile photo of Justin King
    Justin King
    Participant

    I think you're confusing the computer GUID in AD as the definitive "GUID", which is not that case. A GUID can be assigned to almost anything, including AD Computers, network cards, and DSC configurations.

    Reading between the lines, I think you are hoping to simply assign the GUID in AD to your DSC configuration which is a common request:

    (Get-ADComputer "somecomputernamehere").ObjectGUID
    

    HOWEVER, that's not the only GUID a machine owns. For example, you can get a unique one off each of your network cards too (people who play with PXE know of this well):

    Get-WmiObject Win32_NetworkAdapter -Filter "netenabled = true" | Select Guid
    

    The reason people tend to use [guid]::NewGUID() is becuase then the LCM isn't bound to a particular domain ... nor does it require a domain at all. Freeing this relationship lets you make configurations that change computers from one domain to another, or even manage them in workgroup mode.

    It's all about scope.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.