I am also having trouble adding the machine to the domain during provision. 
 I am using a SHELL provisioner and running a BoxStarter script which has 
something like

$computer = Get-WMIObject win32_computersystem
$memberStatus = ($computer).domainrole
$domainName = "myDomain.com"

if ($memberStatus -eq 0 -or $memberStatus -eq 2)  
{
    $User = "myDomain.com\SuperUser"
    $pWord = ConvertTo-SecureString –String "Passw0rd!" –AsPlainText -Force
    $cred = New-Object –TypeName 
"System.Management.Automation.PSCredential" –ArgumentList $User, $PWord
        #Add the computer to the domain if it's a 'Standalone Workstation' 
(0) or 'Standalone Server' (2) only
        Add-Computer -DomainName $domainName -NewName $computer -Credential 
$cred
        #Add 'Domain Users' to the Local Administrators group on the 
computer
        $group = [ADSI]"WinNT://./Administrators,group"
        $group.Add("WinNT://$domainName/My.User,$group")

        if (Test-PendingReboot){Invoke-Reboot}
    
}


But I get 

==> Client:  Chocolatey installed 1/1 package(s). 0 package(s) failed.     
                                    
==> Client:   See the log for details 
(C:\ProgramData\chocolatey\logs\chocolatey.log).                         
==> Client:  + Boxstarter finished Calling Chocolatey to install dotnet3.5. 
This may take several minutes to co
mplete... 00:03:12.1516303                                                 
                                    
==> Client:  ConvertTo-SecureString : The parameter value "Æ'?String 
Passw0rd! Æ'?AsPlainText" is not a valid 
encrypted string.                                                           
                                   
==> Client:  At 
C:\ProgramData\chocolatey\lib\temp_BoxstarterPackage\tools\ChocolateyInstall.ps1:15
 
char:14    
==> Client:  + ...    $pWord = ConvertTo-SecureString Æ'?"String 
"Passw0rd!" Æ'?"AsPlainT ...                 
==> Client:  +                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                   
    
==> Client:                                                                 
                                   
==> Client:      + CategoryInfo          : InvalidArgument: (:) 
[ConvertTo-SecureString], PSArgumentException  
==> Client:      + FullyQualifiedErrorId : 
ImportSecureString_InvalidArgument,Microsoft.PowerShell.Commands.Con
vertToSecureStringCo                                                       
                                    
==> Client:     mmand                                                       
                                   
==> Client:  New-Object : Cannot find type [Æ'?TypeName 
System.Management.Automation.PSCredential Æ'?ArgumentLi
st]: verify that the as                                                     
                                   
==> Client:  sembly containing this type is loaded.                         
                                   
==> Client:                                                                 
                                   
==> Client:  At 
C:\ProgramData\chocolatey\lib\temp_BoxstarterPackage\tools\ChocolateyInstall.ps1:16
 
char:13    
==> Client:  +     $cred = New-Object Æ'?"TypeName 
"System.Management.Automation.PSCr ...                      
==> Client:  +             
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                   
        
==> Client:      + CategoryInfo          : InvalidType: (:) [New-Object], 
PSArgumentException                  
==> Client:      + FullyQualifiedErrorId : 
TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand         


Any help appreciated.

Ed

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vagrant-up+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/ec805332-5591-4955-a26a-cb086f9ef6c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to