Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Powershell script to change feature permissions in IIS

Powershell script to change feature permissions in IIS

Powershell script to change feature permissions in IIS

I am trying to create a script to follow a citrix doc to enable IIS and XML integration. (article CTX125107)


One of the steps is to Edit Feature permissions within a Virtual Directory and Web Application. It must be changed to 'Execute'
I am sure there is a one liner for powershell that does this but I cannot find it.

Does anyone know how to do this?

I current have a Scripts virtual directory under the Default Web Site

The script i have so far is as follows and all I need now is to change the feature permissions to execute and create a registry key.

Of course i have not even tested this script yet so I am not sure if it will work or not.

My code is below for the script:


Import-Module "WebAdministration"
Stop-Service ctxhttp
$svc = Get-Service ctxhttp
while($svc.State -ne 'Stopped')
   Start-Sleep -Seconds 1

#Uninstalls Citrix XML Service
(Get-WmiObject Win32_Service -filter "name='ctxxmlss'").Delete()
#Creates Scripts Directory & Copies files to scripts directory
cd IIS:
Write-Host "Starting Script" -foregroundcolor "Cyan"
$dpath = "c:\inetpub\scripts"
$spath = "c:\Program Files(x86)\Citrix\System32"
Write-Host "Verifying reuired directories exist..." -foregroundcolor "Yellow"
if (!(test-path -path $dpath))
	Write-Host "Creating Directory : " + dpath -foregroundcolor "Yellow"
	New-Item $dpath -ItemType directory
if (!(test-path -path $dpath + "\CtxAdmin"))
	Write-Host "Creating Directory : " + dpath + "\CtxAdmin" -foregroundcolor "Yellow"
	New-Item $dpath + "\CtxAdmin" -ItemType directory
if (!(test-path -path $dpath + "\resource"))
	Write-Host "Creating Directory : " + dpath + "\resource" -foregroundcolor "Yellow"
	New-Item $dpath + "\resource" -ItemType directory
if (!(test-path -path $dpath + "\resource\en"))
	Write-Host "Creating Directory : " + dpath + "\resource\en" -foregroundcolor "Yellow"
	New-Item $dpath + "\resource\en" -ItemType directory
Write-Host "All directories in place and/or created" -foregroundcolor "Green"

#copy approproate files
Write-Host "Copying Files...Please wait.." -foregroundcolor "Yellow"
if (!(Test-Path $dpath + "\" + vfile$))
Copy-Item $spath + "\" + vfile$ $dpath
if (!(Test-Path $dpath + "\" + vfile$))
Copy-Item $spath + "\" + vfile$ $dpath
if (!(Test-Path $dpath + "\" + vfile$))
Copy-Item $spath + "\" + vfile$ $dpath
if (!(Test-Path $dpath + "\" + vfile$))
Copy-Item $spath + "\" + vfile$ $dpath
if (!(Test-Path $dpath + "\" + vfile$))
Copy-Item $spath + "\" + vfile$ $dpath
if (!(Test-Path $dpath + "\" + vfile$))
Copy-Item $spath + "\" + vfile$ $dpath
if (!(Test-Path $dpath + "\resources\en\" + vfile$))
Copy-Item $spath + "\resources\en\" + vfile$ $dpath + "\resources\en"
Write-Host "File Copies completed.." -foregroundcolor "Green"
Write-Host "Starting IIS configuration" -foregroundcolor "Yellow"
Write-Host "Adding new Site ISAPI Restrictions...Please Wait.." -foregroundcolor "Yellow"
set-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='c:\inetpub\scripts\CtxConfProxy.dll']/@allowed" -value "True" -PSPath:IIS:set-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='c:\inetpub\scripts\ctxsta.dll']/@allowed" -value "True" -PSPath:IIS:set-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='c:\inetpub\scripts\radexml.dll']/@allowed" -value "True" -PSPath:IIS:set-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='c:\inetpub\scripts\wpnbr.dll']/@allowed" -value "True" -PSPath:IIS:set-webconfiguration "/system.webServer/security/isapiCgiRestriction/add[@path='c:\inetpub\scripts\CtxAdmin\ctxadmin.dll']/@allowed" -value "True" -PSPath:IIS:Write-Host "Site ISAPI Restrictions completed!" -foregroundcolor "Green"
Write-Host "Creating Appplication Pools...Please Wait..." -foregroundcolor "Yellow"
New-Item IIS:\AppPools\CtxScriptsPool
Write-Host "Creating Appplication Pools...Completed..." -foregroundcolor "Green"
Write-Host "Configuring Application Pool Settings...Please Wait..." -foregroundcolor "Yellow"
Set-ItemProperty IIS:\AppPools\CtxScriptsPool -name managedRuntimeVersion -value v2.0
Set-ItemProperty IIS:\AppPools\CtxScriptsPool -name managedPipelineMode -value Classic
Set-ItemProperty IIS:\AppPools\CtxScriptsPool -name autoStart -value true
Set-ItemProperty -Path IIS:\AppPools\CtxScriptsPool-Name ProcessModel.IdentityType -value 2
Set-ItemProperty IIS:\AppPools\CtxAdminPool -name managedRuntimeVersion -value v2.0
Set-ItemProperty IIS:\AppPools\CtxAdminPool -name managedPipelineMode -value Classic
Set-ItemProperty IIS:\AppPools\CtxAdminPool -name autoStart -value true
Set-ItemProperty -Path IIS:\AppPools\CtxAdminPool-Name ProcessModel.IdentityType -value 2
Write-Host "Configuring Application Pool Settings...Complete..." -foregroundcolor "Green"

Write-Host "Creating IIS Scripts Application...Please Wait..." -foregroundcolor "Yellow"
New-Item "IIS:\Sites\Default Web Site\Scripts" -physicalPath c:\inetpub\Scripts -type Application
Set-ItemProperty iis:\Sites\Default Web Site\Scripts -Name applicationpool -Value CtxScriptsPool
Write-Host "Creating IIS Scripts Application...Complete..." -foregroundcolor "Green"
Write-Host "Creating IIS CtxAdmin Application...Please Wait..." -foregroundcolor "Yellow"
New-Item "IIS:\Sites\Default Web Site\CtxAdmin" -physicalPath c:\inetpub\Scripts\ctxadmin -type Application
Set-ItemProperty iis:\Sites\Default Web Site\CtxAdmin -Name applicationpool -Value CtxAdminPool
Write-Host "Creating IIS CtxAdmin Application...Complete..." -foregroundcolor "Green"
Write-Host "Creating CTXIntegrated Virtual Directory...Please Wait..." -ForegroundColor "Yellow"
New-Item 'IIS:\Sites\Default Web Site\Scripts\CtxIntegrated' -Type VirtualDirectory -PhysicalPath C:\inetpub\Scripts 

RE: Powershell script to change feature permissions in IIS

Take a look at AppCmd which you can automate with PowerShell.

I hope that helps.



Check out my scripting solutions at http://www.thespidersparlor.com/vbscript

Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close