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}
}
==> 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.