Hi,

I am trying to install vmtools using a powershell script below. Above 
snippets are for dealing with TLS issues. 
I am facing issue with installing with last command for installation. Same 
command works fine when run manually but not when run through Packer.



add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object 
TrustAllCertsPolicy;
(New-Object 
System.Net.WebClient).DownloadFile('https://10.7.64.21/swrepo/VMwareTools.zip','C:\Windows\Temp\VMwareTools.zip');
Start-Sleep -Seconds 60;
#Microsoft.PowerShell.Archive\Expand-Archive -literalpath 
'C:\Windows\Temp\VMwareTools.zip' -destinationpath 
'C:\Windows\Temp\VMwareTools';
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
    param([string]$zipfile, [string]$outpath)

    [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}

Unzip "C:\Windows\Temp\VMwareTools.zip" "C:\Windows\Temp\VMwareTools"
Start-Sleep -Seconds 20;
Start-Process -Wait -PassThru -FilePath 
C:\Windows\Temp\VMWaretools\VMWaretools\setup64.exe -ArgumentList "/S /l 
C:\Windows\Temp\vmware_tools.log /v""/qn REBOOT=R""";
Start-Sleep -Seconds 300;



Please see output below in logging mode. No errors are being thrown and 
showing successful, but nothing has happened inside VM. Tried installing 
changing different parameters but no luck.

Output
======

==> vmware-iso: Provisioning with Powershell...

==> vmware-iso: Provisioning with powershell script: post_windows2.ps1

2019/05/21 08:30:01 cracklib-packer: 2019/05/21 08:30:01 Opening 
post_windows2.ps1 for reading

2019/05/21 08:30:01 cracklib-packer: 2019/05/21 08:30:01 Uploading env vars 
to 
c:/Windows/Temp/packer-ps-env-vars-5ce3f82d-9a5e-bf27-ac72-f14cc6752312.ps1

2019/05/21 08:30:01 cracklib-packer: 2019/05/21 08:30:01 [INFO] 76 bytes 
written for 'uploadData'

2019/05/21 08:30:01 [INFO] 76 bytes written for 'uploadData'

2019/05/21 08:30:01 cracklib-packer: 2019/05/21 08:30:01 Uploading file to 
'c:/Windows/Temp/packer-ps-env-vars-5ce3f82d-9a5e-bf27-ac72-f14cc6752312.ps1'

2019/05/21 08:30:25 cracklib-packer: 2019/05/21 08:30:25 Uploading file to 
'c:/Windows/Temp/script-5ce3f82d-affa-c82d-499f-42e5b41dcf37.ps1'

2019/05/21 08:30:25 cracklib-packer: 2019/05/21 08:30:25 [INFO] 1226 bytes 
written for 'uploadData'

2019/05/21 08:30:25 [INFO] 1226 bytes written for 'uploadData'

2019/05/21 08:30:36 cracklib-packer: 2019/05/21 08:30:36 [INFO] starting 
remote command: powershell -executionpolicy bypass "& { if (Test-Path 
variable:global:ProgressPreference){set-variable -name 
variable:global:ProgressPreference -value 'SilentlyContinue'};. 
c:/Windows/Temp/packer-ps-env-vars-5ce3f82d-9a5e-bf27-ac72-f14cc6752312.ps1; 
&'c:/Windows/Temp/script-5ce3f82d-affa-c82d-499f-42e5b41dcf37.ps1'; exit 
$LastExitCode }"

    vmware-iso:

    vmware-iso: Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id 
ProcessName

    vmware-iso: -------  ------    -----      ----- -----   ------     -- 
-----------

    vmware-iso:      54       5      768       3216    43     0.06    908 
setup64

2019/05/21 08:36:21 cracklib-packer: 2019/05/21 08:36:21 [INFO] command 
'powershell -executionpolicy bypass "& { if (Test-Path 
variable:global:ProgressPreference){set-variable -name 
variable:global:ProgressPreference -value 'SilentlyContinue'};. 
c:/Windows/Temp/packer-ps-env-vars-5ce3f82d-9a5e-bf27-ac72-f14cc6752312.ps1; 
&'c:/Windows/Temp/script-5ce3f82d-affa-c82d-499f-42e5b41dcf37.ps1'; exit 
$LastExitCode }"' exited with code: 0

2019/05/21 08:36:21 cracklib-packer: 2019/05/21 08:36:21 [INFO] RPC 
endpoint: Communicator ended with: 0

2019/05/21 08:36:21 [INFO] 245 bytes written for 'stdout'

2019/05/21 08:36:21 [INFO] 0 bytes written for 'stderr'

2019/05/21 08:36:21 [INFO] RPC client: Communicator ended with: 0

2019/05/21 08:36:21 [INFO] RPC endpoint: Communicator ended with: 0

2019/05/21 08:36:21 cracklib-packer: 2019/05/21 08:36:21 [INFO] 245 bytes 
written for 'stdout'

2019/05/21 08:36:21 cracklib-packer: 2019/05/21 08:36:21 [INFO] 0 bytes 
written for 'stderr'

2019/05/21 08:36:21 [INFO] (telemetry) ending powershell


Thanks in advance

Shyam

-- 
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/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/0d190855-6837-4b3a-b46b-10f8b09dc223%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to