Skip navigation
VMware

This Question is Answered (go to answer)

1,022 Views 9 Replies Last post: Jul 25, 2010 10:03 AM by RobMokkink RSS
RobMokkink Expert 811 posts since
Jun 7, 2005
Currently Being Moderated

Jul 22, 2010 1:01 PM

JoinDomain_Task + cmdlet

 

Is there also a cmdlet for the JoinDomain_Task?

 

 

So i can configure the Authentication Services

 

 

RvdNieuwendijk Virtuoso User Moderators vExpert 1,261 posts since
Aug 3, 2009
Currently Being Moderated
1. Jul 22, 2010 1:49 PM in response to: RobMokkink
Re: JoinDomain_Task + cmdlet

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

LucD Guru User Moderators vExpert 8,981 posts since
Oct 31, 2005
Currently Being Moderated
3. Jul 22, 2010 11:44 PM in response to: RobMokkink
Re: JoinDomain_Task + cmdlet

Do you mean the call to JoinDomain_Task ?

 

 

 

 

____________

Blog: LucD notes

Twitter: lucd22

Blog: http://lucd.info | Twitter: @LucD22 | Book co-author: http://powerclibook.com
ykalchev Expert VMware Employees 203 posts since
Mar 5, 2008
Currently Being Moderated
5. Jul 22, 2010 11:47 PM in response to: RobMokkink
Re: JoinDomain_Task + cmdlet

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

Attachments:
Yasen Kalchev, PowerCLI Dev Team
LucD Guru User Moderators vExpert 8,981 posts since
Oct 31, 2005
Currently Being Moderated
8. Jul 25, 2010 8:46 AM in response to: RobMokkink
Re: JoinDomain_Task + cmdlet

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: http://lucd.info | Twitter: @LucD22 | Book co-author: http://powerclibook.com

Bookmarked By (0)

Share This Page

Communities