我正在尝试安装Microsoft 2010,我已经创建了一个MSP和config.xml文件,这样我就可以使用下面的命令从Powershell执行此操作:
Start-Process "C:\temp\Office2010\x86\setup.exe" -ArgumentList "/config `"Config.xml`" /adminfile `"custom.MSP`"" -Wait -NoNewWindow这件事做得很好。在等待setup.exe完成后,将安装Office。
但是,使用以下命令从远程计算机运行这个相同的命令:
Invoke-Command -computer computer -Credential user -ScriptBlock { Start-Process "C:\temp\Office2010\x86\setup.exe" -ArgumentList "/config `"Config.xml`" /adminfile `"custom.MSP`"" -Wait -NoNewWindow}我知道命令正在执行,因为安装程序正在创建日志文件,但是日志突然停止了https://gist.github.com/smudgerdan/62a5e44300a9590d6174。
是否有什么东西意味着winrm不等待setup.exe完成?如何通过winrm安装Office 2010?
发布于 2017-05-31 16:36:09
在不同的程序中遇到类似的问题--发现*.bat与GPO指定的计划任务相结合,在所有windows版本/OS中都更加准确/有效。有许多"示例“项目需要编辑,所以一定要扫描它。
此脚本允许: 1.验证OS 2.验证程序是否已安装3.卸载(如果已安装)并清除信任4.使用所需的信任5安装*.exe .创建集中式日志
如果不需要,这些特性中的任何一个都可以是"REM“。
请见下文:
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.https://serverfault.com/questions/651900
复制相似问题