Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Managing Hostnames vs. GUIDs on a Pull Server

$
0
0

Generating the MOF file based off a GUID name has nothing to do with the mode the machine is in. That would change only if you pushed a configuration to the machine.

On some of my scripts, at the bottom it looks like this:

Configuration DSC_File_Server
{
	.. .
}
Configuration SetPullMode
{
	.. .
}
 
DSC_File_Server -ComputerName $ComputerName
$Guid = ([guid]([adsisearcher]"(samaccountname=$ComputerName`$)").FindOne().Properties["objectguid"][0]).Guid
$Destination = "\\PULLSERVER\C`$\Program Files\WindowsPowerShell\DscService\Configuration\$Guid.mof"
Copy-Item -Path .\DSC_File_Server\$ComputerName.mof -Destination $Destination
New-DSCCheckSum -ConfigurationPath $Destination -Force
Start-DscConfiguration .\DSC_File_Server -Verbose -Wait -Force
SetPullMode -ComputerName $ComputerName -Guid $Guid -OutputPath .\SetPullMode
Set-DscLocalConfigurationManager -ComputerName $ComputerName .\SetPullMode -Verbose

So I still end up with a folder that has the computer name in it, and the ComputerName.MOF file, but then on the pull server it is a GUID. I suppose I could just change the name, and then copy it over. In this particular script, I ran the config first, and then changed it to pull mode after just because I like to see the first run of some of them. Hopefully that is helpful in some way.


Viewing all articles
Browse latest Browse all 13067

Trending Articles