PowerCLI

 View Only
  • 1.  How do you Invoke-VMscript an executable

    Posted Jul 16, 2020 12:27 PM

    Sorry for the repeated question wasn't sure if I should add a reply to an answered question which shows no code.

    Everything in green works but I've searched hours and am not able to figure out how to execute the vcredist_x64.exe. I've tried ScriptType bat & powershell. I continue to get "The system cannot find the path specified.

    Foreach($vm in $vms){

    # sets the TSM iso to the Y drive cd-rom  

    Get-VM $vm.name | Get-CDDrive | Set-CDDrive -Connected $true -IsoPath '[DA1-DRDS01-V3] ISOs/TSM 7.1.6.ISO' -StartConnected $true -Confirm:$false

     

    Invoke-VMScript -VM $vm.Name -ScriptText {cmd.exe /c "Y:\ISSetupPrerequisites\TSMClient\{3A3AF437-A9CD-472f-9BC9-8EEDD7505A02}\vcredist_x64.exe" /install /quiet /norestart /log vcredist.txt } -GuestUser 'admin' -GuestPassword 'password' -ScriptType bat

    # Silently installs the TSM agent

    Invoke-VMScript -VM $vm.Name -ScriptText {msiexec /i "Y:\TSMClient\IBM Tivoli Storage Manager Client.msi" RebootYesNo="No" REBOOT="Suppress" ALLUSERS=1 INSTALLDIR="C:\Program Files\Tivoli\Tsm" ADDLOCAL="BackupArchiveGUI,BackupArchiveWeb,Api64Runtime,AdministrativeCmd" TRANSFORMS=1033.mst /qn /l*v "C:\Tivoli log.txt"} -GuestUser 'admin' -GuestPassword 'password' -ScriptType Bat

    # disconnects the ISO

    Get-VM $vm.name | Get-CDDrive | Set-CDDrive -Connected $false -Confirm:$false

    }



  • 2.  RE: How do you Invoke-VMscript an executable
    Best Answer

    Posted Jul 16, 2020 12:49 PM

    Is that an error from Invoke-VMScript or from the run inside the Guest OS?

    Can you show the complete error message?

    Also, is there anything in the log vcredist.log?



  • 3.  RE: How do you Invoke-VMscript an executable

    Posted Jul 16, 2020 02:17 PM

    Appears to be from inside the guest.

    PS C:\Windows\system32>     Invoke-VMScript -VM $vm.Name -ScriptText {cmd.exe /c "Y:\ISSetupPrerequisites\TSMClient\{3A3AF437-A9CD-472f-9BC9-8EEDD7505A02}\vcredist_x64.exe" /install /quiet /norestart /log vcredist.txt } -GuestUser 'admin -GuestPassword 'password' -ScriptType bat

    ScriptOutput

    -----------------------------------------------------------------------------------------------------------------------|  The system cannot find the path specified.

    -----------------------------------------------------------------------------------------------------------------------

    I didn't find a vcredist.txt file but I did find a dd_vcredist_amd64_20200716084710.txt file with a date\time stamp today.

    [0F0C:0D5C][2020-07-16T08:47:10]: Burn v3.6.3542.0, Windows v6.3 (Build 9600: Service Pack 0), path: Y:\TSMClient\ISSetupPrerequisites\{3A3AF437-A9CD-472f-9BC9-8EEDD7505A02}\vcredist_x64.exe, cmdline: '/? -burn.unelevated BurnPipe.{47DF12B2-337D-4611-9B5B-192171B380EF} {00EE046D-B5F7-4AE3-883A-E6BEF83A8FB0} 236'

    [0F0C:0D5C][2020-07-16T08:47:10]: Setting string variable 'WixBundleLog' to value 'C:\Users\ADMINI~1\AppData\Local\Temp\dd_vcredist_amd64_20200716084710.log'

    [0F0C:0D5C][2020-07-16T08:47:10]: Setting string variable 'WixBundleOriginalSource' to value 'Y:\TSMClient\ISSetupPrerequisites\{3A3AF437-A9CD-472f-9BC9-8EEDD7505A02}\vcredist_x64.exe'

    [0F0C:0D5C][2020-07-16T08:47:10]: Setting string variable 'WixBundleName' to value 'Microsoft Visual C++ 2012 Redistributable (x64) - 11.0.61030'



  • 4.  RE: How do you Invoke-VMscript an executable

    Posted Jul 16, 2020 02:32 PM

    Could it be that this user you used has never logged into the target station?

    That way the user would have no profile structure set up.

    Perhaps verbose logging would show what actually goes wrong.

    Add an option like /L*V "C:\Windows\Temp\install.log" to the EXE parameters.

    You are free to take any folder that is writeable for that account.



  • 5.  RE: How do you Invoke-VMscript an executable

    Posted Jul 16, 2020 03:54 PM

    I am embarrassed to say the answer was there in front of me. The beginning path was different and I can only say I am sorry LucD.

    Y:\ISSetupPrerequisites\TSMClient\

    Y:\TSMClient\ISSetupPrerequisites\ correct path