2

I am trying to install Microsoft Office 2010, I have created a MSP and config.xml file so I can do this from Powershell, using the following command:

Start-Process "C:\temp\Office2010\x86\setup.exe" -ArgumentList "/config `"Config.xml`" /adminfile `"custom.MSP`"" -Wait -NoNewWindow

And this works perfectly. After waiting for the setup.exe to finish Office is installed.

But running this same command from a remote machine using the following command:

Invoke-Command -computer computer -Credential user -ScriptBlock { Start-Process "C:\temp\Office2010\x86\setup.exe" -ArgumentList "/config `"Config.xml`" /adminfile `"custom.MSP`"" -Wait -NoNewWindow}

I know command is being executed because the installer is creating a log file but the log just stops abruptly https://gist.github.com/smudgerdan/62a5e44300a9590d6174

Is there something which means that winrm doesn't wait around for setup.exe to finish? How can I install Office 2010 via winrm?

5
  • A silly question: I'm assuming that the user creds have admin permissions on the remote PC, but are you doing this from an elevated PowerShell terminal? Dec 11, 2014 at 16:33
  • The user creds are the same for when logged into the machine or provided to invoke-command from the remote machine. Both the local & remote machine's powershell terminals are elevated.
    – SmudgerDan
    Dec 11, 2014 at 16:53
  • I don't know the answer to this, so I'll just throw it out there. Windows updates are exceptionally difficult to install remotely because of security considerations around the Windows installer service... is your problem installing office remotely running into the same problem? Dec 11, 2014 at 19:38
  • It might be. I am installing .NET 4.0 through winrm by using the switch "/SkipMSUInstall" and then installing the .cab files. Which gets around this issue, does Office 2010 having something similar?
    – SmudgerDan
    Dec 15, 2014 at 11:15
  • The answer seems to be to setup a scheduled task via winrm to install the software. This seems to be how products such as chef and vagrant work. The issues and possible solutions to this are detailed in Matt Wrock's Blog post www.hurryupandwait.io/blog/safely-running-windows-automation-operations-that-typically-fail-over-winrm-or-powershell-remoting
    – SmudgerDan
    Jul 31, 2015 at 7:38

1 Answer 1

0

Ran into similar issues with a different program - found that a *.bat combined with a Scheduled Task Designated by a GPO to be more accurate/effective with all windows versions/OS's. There are many "[example]" items to be edited so be sure to scan through it.

This script allows for : 1. verifying OS 2. verifying if program is already installed 3. Uninstalling if already installed and clearing configs 4. Installing *.exe with desired configs 5. Creating centralized logs

Any of these features can be "REM" if not desired.

Please see below :

Rem This is to install a program using a batch file - this can be triggered by a GPO scheduled task item.

Rem -------------------Variables to Adjust----------------------
Rem
Rem 1. Location of exe and batch file source - 
Rem     a. Everyone has full or r/w access to (possibly a SHARE)
Rem     b. Has no spaces in path
Rem
set DeployDirectory=\\[IP\Client\Windows\Office2010\]
REm
Rem 2. Location of logs
Rem 
set logshare=\\[IP\Client\Windows\Office2010\logs]
Rem
Rem 3. Change commands to go with *.exe if needed.
Rem
set CommandLineOptions=["/config `"Config.xml`" /adminfile `"custom.MSP`"" -Wait -NoNewWindow]
Rem
Rem
Rem --------------------------------------------------------------

IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)

:64BIT
wmic product where name="[name of program when viewing "programs and features]" call uninstall
wmic product where name="[name of program when viewing "programs and features]" call uninstall
REG DELETE HKLM\SOFTWARE\[name of program in regedit] /F
echo deployment x64 %ComputerName%
"%DeployDirectory%\[Nameoffilex64.exe]" %commandlineoptions%
if %errorlevel% neq 0 (GOTO ERRORED) ELSE (GOTO Complete)

:32BIT
wmic product where name="[name of program when viewing "programs and features]" call uninstall
wmic product where name="[name of program when viewing "programs and features]" call uninstall
REG DELETE HKLM\SOFTWARE\[name of program in regedit] /F
echo deployment x32 %Computername%
"%DeployDirectory%\[Nameoffilex86.exe]" %commandlineoptions%
if %errorlevel% neq 0 (GOTO ERRORED) ELSE (GOTO Complete)

:Complete
echo %date% %time% the %0 script has completed successfully >> %logshare%\%ComputerName%.log
Rem pause
GoTo END

:Errored
echo %date% %time% Deployment ended with error code %errorlevel%. >> %logshare%\%ComputerName%.log
Rem pause
GoTo END

:End

echo GoodBye
Rem pause   




 Please let me know if this resolves the issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .