Hi all,

Please try to understand the problem and give some solution.
I am executing the powershell exe as vbscript CA as follows.

Function f1()
MsgBox("exe started")
Set objShell = CreateObject("Wscript.Shell")
vPSscrIpt = "powershell.exe -NoExit c:\yyy\aa.ps1"
objShell.Run vPSscrIpt
End Function

aa.ps1 content:

Set-ExecutionPolicy RemoteSigned
$ver = $host | select version
if ($ver.Version.Major -gt 1)  {$Host.Runspace.ThreadOptions =
"ReuseThread"}
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction
SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
#Add-PsSnapin Microsoft.SharePoint.PowerShell
Set-location $home
$sapp = Get-SPEnterpriseSearchServiceApplication –Identity “Search Service
Application”
New-SPEnterpriseSearchCrawlContentSource –SearchApplication $sapp –Name “c1”
–Type Custom –StartAddress  protocol://servername –CrawlPriority Normal
–MaxPageEnumerationDepth 1 –MaxSiteEnumerationDepth 1

I decalred the Custom action as follows.
<CustomAction Id="f1" BinaryKey="ca" VBScriptCall="f1" Execute="deferred"
Impersonate="no"  />

Executing the custom action in installExecute seq as follows.

<Custom Action="f1" Before="ProcessComponents">1</Custom>

But this custom action is not able to registering the sharepoint snapin to
the powershell. Add-PSSnapin "Microsoft.SharePoint.PowerShell" is failing.

but If I run the vbscript manually it is executing successfully.

Please tell me some suggestion ...
-- 
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/powershell-is-faling-at-Add-PSSnapin-Microsoft-SharePoint-PowerShell-is-failing-tp5481703p5481703.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to