Is there also a cmdlet for the JoinDomain_Task?
So i can configure the Authentication Services
Hi Rob,
Executing JoinDomain_task in PowerCLI 4.1 is a little bit tricky since some of the new vSphere 4.1 host managers are missing in VMware.Vim assembly. However you can workaround the problem with this simple script:
function GetHostADAuthManagerMoRef($vmHost) { $filter = New-Object VMware.Vim.PropertyFilterSpec $filter.ObjectSet += New-Object VMware.Vim.ObjectSpec $filter.ObjectSet[0].Obj = $vmHost.ConfigManager.AuthenticationManager $filter.PropSet += New-Object VMware.Vim.PropertySpec $filter.PropSet[0].Type = "HostAuthenticationManager" $filter.PropSet[0].All = $true $collector = Get-View $vmHost.Client.ServiceContent.PropertyCollector $content = $collector.RetrieveProperties($filter) $supportedStore = $content[0].PropSet | ? {$_.Name -eq "supportedStore"} $result = $supportedStore.Val | ? {$_.Type -eq "HostActiveDirectoryAuthentication"} return [http://VMware.Vim.VIConvert|http://VMware.Vim.VIConvert]::ToVim41($result) } Connect-VIServer 'MyVC' -User 'Username' -Pass 'Password' $vmHost = Get-View (Get-VMHost 'MyHost') $authManagerMoRef = GetHostADAuthManagerMoRef($vmHost) $taskMoRef = $vmHost.Client.VimService.JoinDomain_Task($authManagerMoRef, 'DomainToJoin', 'DomainUsername', 'Password') $vmHost.WaitForTask([http://VMware.Vim.VIConvert|http://VMware.Vim.VIConvert]::ToVim($taskMoRef))
Regards,
Yasen Kalchev
PowerCLI Dev Team
Afaik there is no cmdlet for the JoinDomain_Task. The JoinDomain_Task in HostActiveDirectoryAuthentication is new in PowerCLI 4.1. In the VMware vSphere PowerCLI Change Log there is no cmdlet mentioned for this task.
Regards, Robert
I am struggeling a little bit with the SDK on this subject.
How can you enable the JoinDomain_task on the host?
Do you mean the call to JoinDomain_Task ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That's the one. I need to configure the authentication services to active directory.
Hi Rob,
Executing JoinDomain_task in PowerCLI 4.1 is a little bit tricky since some of the new vSphere 4.1 host managers are missing in VMware.Vim assembly. However you can workaround the problem with this simple script:
function GetHostADAuthManagerMoRef($vmHost) { $filter = New-Object VMware.Vim.PropertyFilterSpec $filter.ObjectSet += New-Object VMware.Vim.ObjectSpec $filter.ObjectSet[0].Obj = $vmHost.ConfigManager.AuthenticationManager $filter.PropSet += New-Object VMware.Vim.PropertySpec $filter.PropSet[0].Type = "HostAuthenticationManager" $filter.PropSet[0].All = $true $collector = Get-View $vmHost.Client.ServiceContent.PropertyCollector $content = $collector.RetrieveProperties($filter) $supportedStore = $content[0].PropSet | ? {$_.Name -eq "supportedStore"} $result = $supportedStore.Val | ? {$_.Type -eq "HostActiveDirectoryAuthentication"} return [http://VMware.Vim.VIConvert|http://VMware.Vim.VIConvert]::ToVim41($result) } Connect-VIServer 'MyVC' -User 'Username' -Pass 'Password' $vmHost = Get-View (Get-VMHost 'MyHost') $authManagerMoRef = GetHostADAuthManagerMoRef($vmHost) $taskMoRef = $vmHost.Client.VimService.JoinDomain_Task($authManagerMoRef, 'DomainToJoin', 'DomainUsername', 'Password') $vmHost.WaitForTask([http://VMware.Vim.VIConvert|http://VMware.Vim.VIConvert]::ToVim($taskMoRef))
Regards,
Yasen Kalchev
PowerCLI Dev Team
Hi Yasen,
Thanks for your quick response. I will test it asap.
It work perfectly. Thanks a lot!
Fyi I created a function around this bypass and added a function to retrieve the authentication settings.
See my Script vSphere 4.1 AD Authentication post.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc thanks for the great functions.