Jay*_*ang 7 powershell windows-installer p4v dsc
我正在尝试使用Powershell DSC的Package资源来安装exe ... Perforce的P4V是具体的.这是我的代码:
Configuration PerforceMachine
{
Node "SERVERNAME"
{
Package P4V
{
Ensure = "Present"
Name = "Perforce Visual Components"
Path = "\\nas\share\p4vinst64.exe"
ProductId = ''
Arguments = "/S /V/qn" # args for silent mode
LogPath = "$env:ProgramData\p4v_install.log"
}
}
}
Run Code Online (Sandbox Code Playgroud)
运行时,这是Powershell给我的错误:
PowerShell provider MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: The return code 1619 was not expected. Configuration is likely not
correct
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : SERVERNAME
Run Code Online (Sandbox Code Playgroud)
根据文档,返回代码1619表示无法打开MSI包.但是,当我手动登录到计算机并运行" \\nas\share\p4vinst64.exe/S/V/qn "时,安装工作正常.
有谁知道为什么会失败?或者,任何人都可以告诉我如何解决这个问题?我粘贴了从终端获取的所有错误信息,我的日志文件(p4v_install.log)是一个0字节的文件,并且事件查看器中没有事件.我不知道如何进一步排除故障!
编辑:我应该注意,我也尝试使用文件资源在本地复制文件,然后从那里安装它.可悲的是,这也得到了同样的结果.
Daniel在Powershell.org论坛上能够为我解决这个问题.
如果您作为LocalSystem执行,P4V InstallShield安装程序包将MSI文件放入错误的路径.
我已经设法开发了一个有效的配置,见下文.关键是这里的/ b开关,它将MSI文件放入一个定义的位置.我已添加ALLUSERS = 1以使所有用户都可以看到快捷方式,REBOOT = ReallySuppress以避免突然重启(否则会发生).
Configuration PerforceMachine
{
Package P4V
{
Ensure = "Present"
Name = "Perforce Visual Components"
Path = "C:\My\p4vinst64.exe"
ProductId = ''
Arguments = '/b"C:\Windows\Temp\PerforceClient" /S /V"/qn ALLUSERS=1 REBOOT=ReallySuppress"' # args for silent mode
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12859 次 |
| 最近记录: |