From NSIS Wiki
|Author: Kamyar (talk, contrib)|
- 1 Links
- 2 Description
- 3 Functions
- 3.1 NsisIIS::CreateVDir
- 3.2 NsisIIS::DeleteVDir
- 3.3 NsisIIS::GetVDir
- 3.4 NsisIIS::ListVDirs
- 3.5 NsisIIS::Start
- 3.6 NsisIIS::Stop
- 3.7 NsisIIS::Pause
- 3.8 NsisIIS::Resume
- 3.9 NsisIIS::GetIIsInfo
- 3.10 NsisIIS::ListWebSites
- 3.11 NsisIIS::CreateWebSite
- 3.12 NsisIIS::DeleteWebSite
- 3.13 NsisIIS::GetWebSite
- 3.14 NsisIIS::ListAppPools
- 3.15 NsisIIS::CreateAppPool
- 3.16 NsisIIS::DeleteAppPool
- 3.17 NsisIIS::GetAppPool
- 4 TODO
- 5 History
- 6 Alternatives
NsisIIS.zip (16 KB)
NsisIIS plugin to create/edit/delete/getinfo Microsoft IIS virtual directories and manage it's service status
- Copy NsisIIS.dll to Plugins folder of Nsis - Read this readme and example files.
Creates an IIS virtual directory and sets its configuration, or just set the configuration if it already exists.
After calling, you MUST Pop the message, it can be the success or fail message. You can also put the settings to Nsis user variables $1 through $5. See the documentation for details.
Example: NsisIIS::CreateVDir "VDir Name" "Physical Path"
- $1 “Application Pool” name. This is necessary when working with IIS 6 or higher, in which there are different predefined pools. Your asp.net application, usually uses “Classic .NET AppPool”
- $2 “Access Flags”. This is a string describing required access permissions on IIS metabase.
c=script source access
Your string must be a concatenation of these letters. for example: ‘rs’ is default for ASP.net applications.
- $3 “Default Documents” A comma separated list of default documents. Anyone used IIS know what this is.
- $4 “IPSecurity” is a special string we have provided to let the plug-in put IP/Domain access restrictions in place. The first word makes the default behavior. “Grant” means by default all clients are allowed, and the coming items (IP or Domain) are ones who are restricted. “Deny” means the contrary, e.g. all clients are denied access, except the following ones. Here are
Grant All Except (126.96.36.199) (10.10.10.0, 255.255.255.0) (mydomain.net)
Deny All Except (123.321.123.5, 255.255.255.192) (stranger.mydomain.net)
Note that the first IP address can be a single client address or a network entry ip, in which case the next item in the parenthesis is (after comma) the net-mask parameter. Each IP or Domain must be surrounded with parenthesis, and between each item must be space.
- $5 SSL Access flags. Currently not working. This feature will be available in the next minor version.
Extra variables may be added in next versions of this project, since IIS has much more settings to be added.
Deletes an IIS virtual directory by its name. After calling, you MUST Pop the message, it can be the success or fail message.
Example: NsisIIS::DeleteVDir "VDir Name"
Gets an IIS virtual directory configuration (if exists) and put it into user variables $1 through $5. See the documentation for details. After calling, you MUST Pop the message, it can be the success or fail message.
Example: NsisIIS::GetVdir "VDir Name"
Gets a list of IIS Virtual Directory names, as a comma separated string.
Tries to start IIS service if stopped. After calling, you MUST Pop the message, it can be the success or fail message.
Tries to stop IIS service if started. After calling, you MUST Pop the message, it can be the success or fail message.
Tries to pause IIS service if running. After calling, you MUST Pop the message, it can be the success or fail message.
Tries to resume IIS service after calling Pause. After calling, you MUST Pop the message, it can be the success or fail message.
Gets IIS Information. Currently only the version as "major.minor" string in $0.
Tries to get a list of IIS Web Site names, as comma separated "Id:Title" items into $1. Note that in ADSI (and metabase) websites are identified by their index (id), not the name (title or comment).
Creates a website getting its Name (Title), Physical Path, and Bindings respectively. Other optional parameters can be fed into $1 through $4. Bindings are in the format of ADSI standard: hostname:ip:port. The following line creates a website at port 8000, all headers and all assigned IPs.
StrCpy $1 "Classic .NET AppPool" StrCpy $2 "rs" StrCpy $3 "MyWebPage.htm" ;Multiple documents must have a ", " separator. NsisIIS::CreateWebSite "MyWebSite" "D:\WebSite2" "*:8000:" pop $0
For default document, "default.asp, default.htm" will function properly but "default.asp default.htm" or "default.asp,default.htm" will not.
NsisIIS::CreateWebSite sets "ServerBindings" Metabase parameter in C++, which accepts string format as "IP:Port:Hostname" (Microsoft Metabase Property ref.). Latest NsisIIS code(v2.0.1) has a bug to skip 1st character if no comma(,) is found. So we must pass "*" or " " in beginning of string to make it work.
Deletes a website by getting its 1 based index (id).
NsisIIS::DeleteWebSite "2" pop $0
Gets a website information by getting its index (id). Result can be accessed via $0 through $5.
Example: NsisIIS::GetWebSite "2"
Lists all available IIS Application Pools as comma separated list of their names in $1.
Creates an Application Pool getting its name, and optionally other information through $1 to $3.
Example: NsisIIS::CreateAppPool "MyAppPool"
$1 Sets: .Net Framework Version, ex. "v2.0", "v4.0" $2 Sets: Managed Pipeline Mode to "Classic" or "Integrated" $3 Sets: Enable32BitApplications to "true" or "false"
For .Net Framework Version, word document example says "2", "4" which does not work. Source code (v2.0.1) sets managedRuntimeVersion property in C++,which must be in format of vX.Y http://technet.microsoft.com/en-us/library/cc754523(WS.10).aspx)
Deletes an Application Pool getting its ID.
Example: NsisIIS::DeleteAppPool "MyAppPool"
Tries to get an Application Pool information getting its name, and returning the result in variables $1 through $3.
Example: NsisIIS::GetAppPool "MyAppPool"
$1 Returns: ? $2 Returns: .Net Framework Version $3 Returns: Managed Pipeline Mode
- Adding support for Virtual Directories inside a Web Site.
- Adding support for managing another machine (not local) IIS.
- Adding support for SSL & authentication settings.
- Adding support for IIS 8
- 2/24/2010 Released version 1.0.0 & used in my installer.
- 7/21/2011 Released version 2.0.0 & used in my installer.
If the NsisIIS plugin lacks a capability that you need, you can always call appcmd.exe IIS administration tool directly from an install script, like so:
ExecWait '"$WINDIR\system32\inetsrv\appcmd.exe" < arguments >'
Documentation for appcmd is available at http://technet.microsoft.com/en-us/library/cc772200%28v=ws.10%29.aspx