Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<Product>
<!-- Custom Action-->
<CustomAction Id="RegisterInstallPSScript"
Property="RegisterInstallPSScriptProperty"
Value="&quot;C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -ExecutionPolicy Unrestricted -NoProfile -File &quot;[INSTALLLOCATION]\path\to\powershellfile.ps1&quot; -paramName1 &quot;ParamContent1&quot; -paramName2 &quot;paramContent2&quot;"
Execute="immediate" />
<CustomAction Id="RegisterInstallPSScriptProperty"
BinaryKey="WixCA"
DllEntry="CAQuietExec64"
msiexec /i installer.msi /L*V installerLog.log
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Product>
<!-- Property References -->
<PropertyRef Id="WIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED" />
<PropertyRef Id="IISMAJORVERSION" />
<!-- Launch Conditions -->
<Condition Message="Please install the .NET Framework 4.5">
<?xml version="1.0" encoding="UTF-8"?>
<!-- IIS Launch Condition (NOT WORKING) -->
<!-- THis does not work because the IISMAJORVERSION adds a "#" as a prefix to the actual version number. -->
<!-- The version number is treated as a string due to the prefix, and strings cannot be compared with greater than / less than symbols -->
<Condition Message="Please install the Internet Information Service (IIS) version 8 or later.">
<![CDATA[IISMAJORVERSION > 7]]>
</Condition>
<?xml version="1.0" encoding="UTF-8"?>
<Product>
<UI>
<UIRef Id="WixUI_InstallDir" /> <!-- Or whatever built-in / custom UI you like -->
<ProgressText Action="RegisterInstallPSScriptProperty">Powershell script is running, this can take up to 20 minutes. Please wait...</ProgressText>
</UI>
</Product>
<?xml version="1.0" encoding="utf-8"?>
<Product>
<UI>
<!-- UI Dialog Refs-->
<DialogRef Id="SelectDbDlg" />
<DialogRef Id="DbCreateCredDlg" />
<DialogRef Id="GenericErrorDlg" />
<DialogRef Id="WelcomeDlg" />
<DialogRef Id="VerifyReadyDlg" />
<DialogRef Id="ErrorDlg" />
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="ServiceCredDlg_Header" Overridable="yes">[ProductName] Setup</String>
<String Id="ServiceCredDlg_Title" Overridable="yes">{\WixUI_Font_Title}Service Logon Credentials</String>
<String Id="ServiceCredDlg_SubTitle" Overridable="yes">Enter service credentials for the service.</String>
<String Id="ServiceCredDlg_BannerBitmap" Overridable="yes">WixUI_Bmp_Banner</String>
<String Id="ServiceCredDlg_Description" Overridable="yes">[ProductName] installs and runs as an independent Windows service. To operate in this manner, you must supply the user account credentials for [ProductName] to run successfully.</String>
<String Id="ServiceCredDlg_SelectorLabel" Overridable="yes">{\WixUI_Bold}Logon Type:</String>
<String Id="ServiceCredDlg_LocalSystemText" Overridable="yes">Run service as LocalSystem</String>
# Use host\instance,port in general(port is only needed if you connect via TCP; Not needed for localhost)
$DataSource = "localhost\SQLEXPRESS"
$Username = "MyUser"
$Password = "MyPassword"
# Create a new server object
$Server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $DataSource
# Use LoginSecure = $true if you are using the Windows Authentification --> Integrated_Security
# If you do so, you don't need the ConnectionContext.Login or .Password
$Server.ConnectionContext.LoginSecure = $false
$Server.ConnectionContext.Login = $Username
user www-data;
worker_processes 1;
pid /run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
server {
listen 80 default_server;
server_name example.com sub.example.com;
index index.html index.htm
root /path/to/my/root/html/dir; # Default is /var/www/html
location / {
try_files $uri $uri/ =404;
}