PowerShell脚本无法在InstallShield 2015中执行?

时间:2019-05-08 17:19:06

标签: iis-8 powershell-v4.0 installscript installscript-msi installshield-2015

我有一个Installscript代码,在其中我正在函数内执行PowerShell脚本。

我试图通过传递变量中存在的参数来执行我编写的installScript代码以执行脚本,但是我无法成功。

下面是我尝试过的一些installscript示例代码。

svDir = SUPPORTDIR ^ "CreateISSVirtualApp.ps1";

StrRemoveLastSlash (svDir);

szCmdLine = "-File " +"\""+svDir+ "\\CreateISSVirtualApp.ps1" + "\" \"" + s`vVirtualDirName +"\"";

Delay (1);
Disable(WOW64FSREDIRECTION);
nResult = LaunchAppAndWait (szAppPath1, szCmdLine, WAIT);
Enable(WOW64FSREDIRECTION);

我将PS脚本保留在Supportdir中,并将PS脚本的路径保留在szCmdline变量中,并希望传递svVirtualDirName变量中存在的值,但是不知道为什么Power Shell脚本未在ISS中创建虚拟应用程序。

szCmdline变量中的值为

"-File "C:\Users\E5377712\AppData\Local\Temp\2\{0F128485-8953-4D71-AF03-106EA0BA6344}\CreateISSVirtualApp.ps1" "XFormClient""

如果我通过传递agrument手动运行powershell脚本,则它可以正常工作,但使用安装脚本则无法正常工作。

任何帮助,我们将不胜感激。

我还添加了电源外壳的代码,以供下面参考-

param([string]$VirtualAppName)

Import-Module WebAdministration

# Code to get Installation Directory path
$CommonNode=Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SunePI\int\Platform\Common
$GetPath=$CommonNode.KSPath

$InstallDirPath= Split-Path $GetPath

#Appended new REST foldername to $RestPath
$WebRootDirPath= $Path + "\Web Client\www"


New-WebApplication -Name $VirtualAppName -Site 'Default Web Site' -PhysicalPath "$WebRootDirPath" -ApplicationPool DefaultAppPool

0 个答案:

没有答案