Wednesday, December 15, 2010

UAC prevents execution of custom actions during msi installation

In the previous post there was a link to the Robert Flaming's blog where he describes how MSI works with UAC. But I have some additional comments and want write them here:

In the following post Robert describes how permissions change under UAC:

















But what does the NoImpersonate bit means? There are different explanations in different articles. Based on my testing I've found out the following:
When you set Impersonate="no" in WIX for you custom action, it means that the custom action will be executed under the Local System account. And it is fine if you need to do changes with your local system. But if your custom action accesses a remote server it fails.

So, the only way that I've found is to prohibit the msi execution under unprivileged user. You should set the MSIUSEREALADMINDETECTION property to 1 and add a Launch Condition for Privileged that gives an error message about running via an elevated command prompt and then quits the installation.

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

<Condition Message="The installation should be running with full administrative account. Please run an administrative command prompt and launch installation using msiexec.">
Privileged
</Condition>

Wednesday, November 17, 2010

Trusts in Active Directory

The following article explains AD trusts.

Saturday, November 13, 2010

Executing PowerShell script for SharePoint in msi.

If you want to execute PowerShell script in msi written with WIX you may face some problems. Here I explain issues I had in my project:
To execute the script you need to create custom action which runs PowerShell. Note that you cannot run SharePoint Management Shell (at least I didn't find how to do that :). But you can run PowerShell and load SharePoint snap-in inside the script:


<CustomAction Id="PSExecute" Property="PS" ExeCommand="&'[FOLDER]\install-extension.ps1'" Execute='deferred' Return='check'/> 


The script execution may fail due to some reasons. For example, SharePoint Administration service is not running, PowerShell Execution Policy prevents scripts from running, you run msi under account who is not SharePoint Farm administrator. Maybe there are another reasons that I don't know yet ;)

When the script is executed from msi, the PowerShell console is running but you should be a very fast person to catch its output :) So, it is required to add logging into your script. Using Start-Transcript is the only that I'm able to use. Refer to the following post for more information about Start-Transcript.

One more useful thing is "throw 'ERROR'" to abort the script execution if needed. For example SP-GetObject and SP-AddSolution cmdlets may throw errors during execution but they will not cause the script to be completed with error. And installer completes successfully but it actually does not do anything. You can add throw 'ERROR' where is needed and installation ends with Fatal Error.

Friday, October 22, 2010

Installation hangs on "please wait while the installer finishes determining your disk space requirements"

By a some reason installation may hang on a dialogue with the "Please wait while the installer finishes determining your disk space requirements" message (1, 2)


To solve the issue one of the following solutions may help:

  • Stop the installation and start it again.
  • Start installation from command line with /qr switch (i.e. msiexec /i {name.msi} /qr). (qr swtitch - no interaction with user in dialogue wondows)
  • Move msi to a folder with shorter path and run it from there.

What can be done in the msi project:
Remove SpawnWaitDialog event with CostingComplete = 1 condition
CostFinalize does not work

Monday, August 23, 2010

Document Property Parsing in SharePoint

When you upload, move, or copy a file to a document library, Windows SharePoint Services determines if a parser is associated with the document's file type. The parser extracts all the properties and matching property values from the document, and adds them to the property bag object. Windows SharePoint Services accesses the document property bag and determines which properties match the columns for the document. It then promotes those properties, or writes the document property value to the matching document library column.
Windows SharePoint Services can also invoke the parser to demote properties, or write a column value into the matching property in the document itself.
Usefull Links:

Wednesday, July 21, 2010

Changing font for the whole .pdf document generated by LaTeX

The font changing for the whole document generated by LaTeX could be done by specifying the following line in the LaTeX preamble:


\renewcommand{\rmdefault}{cmss}

from here

If you want to use non-default font, you should to install the corresponding package first. The "winfonts" package contains the following fonts:

Arial           Franklin Gothic     Tahoma           Comic Sans
Georgia             TimesCourier New     Palatino Linotype   Verdana
You can download it from here:
The readme file on how to install the package is also included.
Now you can use a non-default font for the pdf:

\renewcommand{\rmdefault}{verdana}

If the source LaTeX document is genereted by Sphinx you should add the line in the end of the "latex_preamble" in the config.py.

Tuesday, July 13, 2010

License is not displayed error in WIXUI_Minimal.

From here
There is a known issue with the rich text control used to display the text of the license file that can cause the text to appear blank until the user scrolls down in the control. This is typically caused by complex RTF content (such as the RTF generated when saving an RTF file in Microsoft Word). If you run into this behavior in your setup UI, one of the following workarounds will fix it in most cases:
  • Open your RTF file in WordPad and save it from there in order to remove the complex RTF content from the file. After saving it, rebuild your MSI.
  • Use a dialog set other than the WixUI_Minimal set. This problem typically only occurs when the license agreement screen is the first one displayed during setup, which only happens with the WixUI_Minimal dialog set.

Friday, July 9, 2010

About SharePoint List view customization

Customizing the user experience of SharePoint: Lists, Custom list forms and CAML views:
http://sharepointmagazine.net/technical/development/customizing-the-user-experience-of-sharepoint-lists-custom-list-forms-and-caml-views-part-3-of-6

Limitations of STSADM -o export/import related to publishing sites

The original article is here

STSADM -o export/import is often used to split site collections into multiple pieces when they reached a certain limit. Or to do the vice versa and consolidate multiple site collections into one larger one. Both of these actions work fine as long as the migrated content does not use the publishing feature.
For site collections that make use of the publishing feature it is not supported to migrate root sites into sub sites or sub sites into root sites.
The reason for this limitation is that the publishing feature stores vital information like page layouts but also various properties like information about variation, reusable content and so on in the root site of a site collection.
When migrating a root site into a subsite the imported content will link to the new location of the previous root site. E.g. the page layout URLs will afterwards point to the page layouts library in the sub site and not of the root site which does not work as the publishing feature requires these items to be in the root site. So additional actions like moving the page layouts to the root site and adjusting all page layout urls would be required. Similar things would be required for variations and reusable content.
On the other hand when migrating a sub site to a root site it gets even worse: in this situation important content which was stored in the root site of the site collection is no longer available as the sub site does not contain the necessary information as they haven't been exported in the first place. So after importing the subsite as new root site items based on the publishing feature will be non functional.
Be aware that this limitation will also affect sites with custom features which store information outside the current site.
Valid migration scenarios when using the publishing feature are the following:
  • export the site collection starting at the root site and import as root site into a new site collection
    (using a custom application you can specify which sub sites to export if you would like to avoid to export all of them)
  • export sub sites of the site collection and import them as sub sites into an existing site collection that has the publishing feature enabled

Tuesday, June 22, 2010

WIX Patch: replace keypath and restart service

I need to create a small update (patch) for my application. I have large application with about 2000 of files. Source project comprises 13 wxs files. A file list is generated by the "heat" command. So, each file is represented as a single component and become a key path (key file) for the component.
During the update I want to replace one dll which is used by a service. So, I have to stop the service, replace the dll and start the service.
After few days of investigation I found out the following:
There are at least two options for patch creation using WIX:
1. Using Purely WiX
2. Using Patch Creation Properties

I prefered the first one.

Commands for the patch creation are discribed in the link above. I did the following:
1. Modify the component for the file to be replaced:
originally was:
<Component Id="cmp1000" Guid="GUID">
<File Id="file1000" KeyPath="yes" Source="$(var.Root)\File.dll" />
</Component>

change to:
<Component Id="cmp1000" Guid="GUID">
<ServiceControl Id='StopServicePatch' Name='ServiceName' Stop='install'/>
<File Id="file1000" KeyPath="yes" Source="{new path}\File.dll" />
<ServiceControl Id='StartServicePatch' Name='ServiceName' Start='install'/>
</Component>
The source file path has been changed as well as ServiceControl actions are added.
2. Build two msi files with the same name
3. Create msp patch file

But if you now run the patch by double clicking on the .msp file, it does not work as expected - it runs UI and asks to choose option for the original application - modify, repair or remove.
4. To install the patch run the following command line:
msiexec /p patch.msp LIMITUI=1 REINSTALLMODE=emus

setting the LIMITUI property restricts UI and the patch is installed without displaying any dialog windows.
the REINSTALLMODE specifies type of reinstallation to be performed. By default the REINSTALLMODE is "omus", but in this case my dll is not replaced as it has the same version number. So, I changed property to "emus" and now the dll is replaced by the patch.

in the log file of the patch installation I see the file is repalced:
Patch Modified Files List:
MSI (s) (A4:64) [15:38:51:275]: File = file1000: Final State = Install
...
File: C:\Program Files (x86)\MyApp\File.dll; Overwrite; Won't patch; Existing file is of an equal version

Tuesday, June 15, 2010

Windows XP: Error parsing the server "IP" "clients.xml" file

I'm running Windows XP and using vSphere for about half a year. After update installation for my Windows XP, got the following error when log in to the vSphere by the client:
Error parsing the server "SERVER IP" "clients.xml" file. Login will continue, contact your system administrator.

I pressed OK and got another error:
The type initializer for "VirtualInfrastructure.Utils.HttpWebRequestProxy" threw an exception

I've googled for the error message and found a lot of articles about the error on Windows 7.
Finally, I've found the solution on the support vmware site for Windows XP and others :)

You cannot use vSphere Clients prior to the Update 1 release, to access the vCenter Server or ESX hosts because of a Microsoft update that targets the .NET Framework (980773), released on June 9th 2010

Perform one of these two options to correct the issue:
  1. Download and install vSphere Client 4.0 Update 1 (build 208111) or Update 2 (build 258672) using method.
  2. Remove the MS update from your Windows operating system. The vSphere Client works after the update is removed.

Thursday, June 10, 2010

Gradual Site Delete: Gradual deletion of site collection in SharePoint 2010

When you delete a Site collection in SharePoint 2010 from Central Administration or from the site collection settings it is deleted gradually.
The gradual deletion is performed by the Timer Job Definition called Gradual Site Delete.
In few words:
The site reference is being deleted from SiteMap and Sites tables of configuration and content databases and added into the SiteDeletion table. The Site collection is unavalaible for users. But sub-sites still exist in the Webs table of content database. This behavior can cause some issues for third-party tools which read these tables.
The Gradual Site Delete Timer Job definition is scheduled to be runnin one time a day. It can be started manually from Central Administration -> Monitoring -> Review job definitions -> Gradual Site Delete.
Here you can edit the timer job or run the job immediately

Refer the following article for more detailed information about the Gradual Site Delete timer job definition.

To delete the site collection completely use the following Powershell command:
Remove-SPSite -Identity ""

Tuesday, June 8, 2010

Reduce software installation time

In MSI 5 there’s a new property MSIFASTINSTALL that can be set on the command line or in the Property table to speed up large install packages. It’s a combination of flags that will avoid creation of a system restore point, skip some costing tasks, reduce the frequency of progress messages, or any combination of these.
http://www.verboon.info/index.php/2009/07/reduce-software-installation-time/

Wednesday, May 26, 2010

SharePoint 2010 wiki home page

When you create a SharePoint 2010 site based on the team site template it automatically activates WikiPageHomePage feature. So, when you open the created site it opens with the SitePages/home.aspx home page.
But the default.aspx page is still there. If you navigate to the team site and append default.aspx to the end of the url, http://host/sites/teamsite/default.aspx, you will notice it takes you to a page very much like the previous 2007 version of SharePoint.
The feature is not activated automatically on Blank site (STS#1) or Document workspace (STS#2)
For more details about the WikiPageHomePage feature refer the following article

Usefull links:
How to change the wiki home page programmatically:

Wednesday, May 19, 2010

Reboot request on Windows 2008 during msi uninstall

During uninstalling application, the following message may appear:
"The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup."

However, there is no need for reboot as all services are stopped before removing any files.

To suppress reboot request, set the REBOOT property to ReallySuppress

Wednesday, May 5, 2010

Adding html tags to the blog

Converts tags to add html/xml to the blog:

Check if related product is already installed

If your application depends on some another basic application, you need to check if the basic application is already installed. You can use the FindRelatedProducts action.
Use the following steps:
1) Define the UpgradeCode of the basic product:
<Upgrade Id="PUT_YOUR_GUID_HERE">
<UpgradeVersion OnlyDetect="yes" Minimum="1.0.0.0" IncludeMinimum='no' Property="BASICINSTALLED" />
</Upgrade>
2) Specify a Custom Action performed if the basic product is not installed:
<CustomAction Id='NotBasic' Error='The basic product should be installed on the server.' />

3) Schedule the custom action execution
<InstallUISequence>
<Custom Action='NotBasic' After='FindRelatedProducts'>NOT BASICINSTALLED</Custom>
</InstallUISequence>

During installation, Windows Installer define a Product Code for the specified Upgrade Code and assign it to the BASICINSTALLED property. If there is no products installed with the Upgarde Code, the property is not defined. In this case the Custom Action will be performed and installation completes.

Note: The property assignment will be skipped if the basic appliaction is installed on per-machine mode but your application is installing in per-user mode.
The following log is written:
FindRelatedProducts: current install is per-user. Related install for product '{Product_Code_GUID}' is per-machine. Skipping...

Wednesday, April 28, 2010

Useful links for WIX UI.

WIX provides you with sets of built-in UI dialogs. To add a dialog set, add the reference the WixUIExtension:
light Product.wixobj -out Product.msi -ext WixUIExtension 
Built-in dialog sets in WIX Tutorial
But what if I need to customize my installation?
The following articles could be usefult to understand how to customize installation dialogs:
Wix Tutorial - Lesson 8
Extending UI
Windows Installer - User Interface Reference
Will try to consolidate all this information into the one article.

Installation process

When we launch Windows Installer engine (by running msiexec.exe) we are launching the client process. Client process will launch the Windows service process.
Log investigation is always helpfull. Read about logs here. The article contains link to a document where log file is explained in more details. Here the link for the document (Annotated_Windows_Installer_Log)

Upd:
one more article about installation phases
how to read Windows Installer Verbose log article
custom actions article

Thursday, April 22, 2010

SharePoint maximum upload size on W2k8

On a Windows Server 2008 computer that has IIS 7.0-only installations, you add the maxAllowedContentLength value. When you are running Windows SharePoint Services on a Windows Server 2008-based computer that has IIS 7.0, you find that you cannot upload files that are larger than 28 MB even though you have configured the large file upload settings. Usually, the error that users see is "The page cannot be displayed." In some circumstances, users may also see an "HTTP 404" error.

To work around this problem refer the following artcile

Tuesday, April 20, 2010

SharePoint administrators comparision

What the Farm admin can do and what cannot?

The following articles describe differences between SP admins:

http://technet.microsoft.com/en-us/library/cc288186.aspx


SharePoint groupDoes role exist by default?Can do thisCannot do this
Farm Administrators
Yes
Perform administrative tasks in Central Administration
Take ownership of any content site.
Administer individual sites or site content unless they take ownership of the site.
GroupDoes role exist by default?Can do thisCannot do this
Administrators
Yes. Windows group that exists by default; not a SharePoint group.
Install products.
Create new Web applications and new Internet Information Services (IIS) Web sites.
Start services.
Deploy Web Parts and new features to the global assembly cache.
Perform all farm-level tasks in Central Administration (provided that the Central Administration site is located on the local computer).
Run the Stsadm command-line tool.
Note Note:
Being a server-level administrator is a pre-requisite of running the Stsadm command-line tool. Depending on which command you actually run, you might need additional permissions. For example, if you run stsadm.exe –o deleteweb, the command requires that the account have write access to the content database that contains the Web application.
Administer individual sites or site content.
Administer databases.
SharePoint groupDoes role exist by default?Can do thisCannot do this
Site collection administrator
Yes
  • Perform all administration tasks for sites within the site collection.
Access the Central Administration site.

SharePoint groupDoes role exist by default?Can do thisCannot do this
Site nameOwners
Yes
Perform administration for the site only, not the entire site collection.
Perform administrative tasks for documents, lists, and libraries.
Access the Central Administration site.
Perform site collection administration tasks, such as restoring items from the second-stage Recycle Bin and managing the site hierarchy.


Tuesday, April 13, 2010

Upload google app via proxy

I receive the following error when try to upload application to google app engine:
urllib2.URLError: urlopen error (10061, 'Connection refused')

Proxy server prevents me from uploading the application. To workaround this I've used the following solution:

set HTTP_PROXY=http://cache.mycompany.com:3128
set HTTPS_PROXY=http://cache.mycompany.com:3128
appcfg.py update myapp

from here

But now I get another issue.
Documentation says:
You cannot specify the password as a command line option.

But it my case I need to specify the password to run the application update from batch file without input it in command line. When I use the "passin" option I get the following error:
EOFError: EOF when reading a line

There is article which describes how to modify appcfg.py file to add the password option

Update:
another solution is:
invoke the python executable followed by the script name

python "C:\Program Files\Google\google_appengine\appcfg.py" --passin --email=[email] update [app_folder]

OR

echo [password] | python "C:\Program Files\Google\google_appengine\appcfg.py" --passin --email=[email] update [app_folder]



Thursday, March 11, 2010

Delete corruption from SharePoint database

The kinds of corruption include the following:
  • Sites that have no Webs
  • Webs that have no sites
  • Webs without a document root folder
  • Webs without parent Webs
  • Lists without a parent Web
  • Lists that contain documents or items without a parent list
http://support.microsoft.com/kb/954773/

Wednesday, March 10, 2010

Auto-generated index in Sphinx

Sphinx allows to create auto-generated index. To do it, add index directive into your .rst files. Sphinx will generate genindex.html file with indexes.
If the genindex.html is not created, make sure the html_use_index option is set to True in the conf.py file.
Use the :ref:`genindex` reference to add link to the Index.

Wednesday, March 3, 2010

How to host html on google apps

The following article describes how to do this:

in few words - look at static_dir and static_files handlers in yaml

Tuesday, March 2, 2010

Generate list of source files

If you need to install a lot of files during setup there are the following tools to generate fole with list of sources:
There is the native tool in WIX package:
From my experience:
Used the following command line:
heat dir "C:\Folder" -cg SGroup -dr INSTALLDIR -out HeatFiles.wxs -gg -sfrag -srd
It generates single component for a file even if all files are located in the same folder. Later, I plan to do upgrades for the original msi, so it can be difficult to maintant the file with such big list of components. Also, when you need to do an update for the original msi the component GUIDs are changed. It may cause issues during installation of the update.

I prefer to use Mallow tool:
It was originally developed for WIXv2
But there is the newest version for Wix v3.
Uses the following command line:
mallow -d "C:\Folder" -t files.wxs -w INSTALLDIR -a SourceDir
It generates single component for all files in a folder. It allows to change original file and preserve component GUIDs - this is very usefull when you create update for your msi. In this case it adds change log in the top of the file.
you need to use the folowing command line:
mallow -d "C:\Folder" -s files.wxs -t files.wxs -w INSTALLDIR -a SourceDir

Inside msi

About msi itself:
To understand reboot requests after installation:

WIX - first steps