Hi all,
I’ve created a PowerShell module for managing our FOG server, and I’m currently having difficulty getting the AD settings to work as expected. I currently have the following when adding a new FOG computer:
$HostJson = @{
"name"= $MachineName
"macs" = @($MacAddress)
"imageID"= $Image.id
"imagename" = $ImageName
"useAD" = $UseAD
"ADDomain" = $ADDomain
"ADUser" = $ADUser
"ADPass" = $FOGPWD
"enforce" = $Enforce
}
Try{
$CreateHostJson = ConvertTo-Json($HostJson)
$CreateHostURL = $BaseUri +"/host/create"
$CreateHostResult = Invoke-RestMethod -Uri $CreateHostURL -Method POST -body $CreateHostJson -Headers $Headers -ContentType "application/json"
}
Catch{
Write-Error $_.Exception.Message
Break
}
However, when checking the FOG client AD settings, I see everything is left unchecked, and the FOG log shows:
Service Creating user agent cache
Middleware::Response Invalid time
Middleware::Response No Printers
Middleware::Response Module is disabled globally on the FOG server
Service Initializing modules
It is only after removing the host manually and running the PowerShell command again (and then rebooting the system) that FOG finally recognises it, but the AD settings still aren’t displayed unless I check the ‘Join Domain After Deploy’ checkbox.
Is there a way to set that through the FOG API, and have the default settings for the domain join filled out? This would also save users of this module having to find and copy/paste the admin password for joining the domain.
Any help with this would be greatly appreciated!