First, if the execution policy doesn't already allow the execution of scripts,
your Set-ExecutionPolicy will never be executed. You can't execute a script to
allow the execution of scripts.
Are you running into a 32/64 bit issue? The Microsoft.SharePoint.PowerShell
snap-in is only registered for 64bit PowerShell and I believe that the VBScript
CA will be running in a 32 bit environment which will get you 32 bit PowerShell.
> -Original Message-
> From: MYFLEX [mailto:shrinuen...@gmail.com]
> Sent: Tuesday, August 31, 2010 4:44 AM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] powershell is faling at Add-PSSnapin
> "Microsoft.SharePoint.PowerShell" is failing.
>
>
> 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.
> Execute="deferred"
> Impersonate="no" />
>
> Executing the custom action in installExecute seq as follows.
>
> 1
>
> 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
--
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