Tag Archives: IIS

Building a Desired State Configuration Pull Server


Quick recap, I’m working through a series of posts about the Desired State Configuration infrastructure that I’m building at Stack Exchange, including some how-to’s.

The High Points

I started with an overview of what and why.  Today, I’m going to start the how.

Building a Pull Server

I’m going to describe how to do this with Server 2012 R2 RTM (NOTE: this is not the General Availability  release, so there may be changes at GA), since that’s the environment I’m working most in.  If there is enough demand, I may follow up with how to do this using the Windows Management Framework on downlevel operating systems after the GA version of WMF 4 is released.

The first step is adding the required roles and features, including the DSC Service.

Add-WindowsFeature Dsc-Service

Fortunately, the Dsc-Service feature has the right dependencies configured so IIS, the correct modules, and the Management OData Extension are all enabled.

Next we need to set up the IIS web site:

  • Create an directory to serve the web application from (I’ll use c:\inetpub\wwwroot\PSDSCPullServer)
  • Copy several files from $pshome/modules/psdesiredstateconfiguration/pullserver (Global.asax, PSDSCPullServer.mof, PSDSCPullServer.svc, PSDSCPullServer.xml) to this directory.
  • Copy PSDSCPullServer.config and rename it to web.config
  • Create a subdirectory named “bin”.
  • Copy one file from $pshome/modules/psdesiredstateconfiguration/pullserver (Microsoft.Powershell.DesiredStateConfiguration.Service.dll) to the “bin” directory.
  • In IIS, create an application pool that runs under the “Local System” account.
  • In, IIS, create a new site (or application in an existing site or just use the existing default site)
  • Point the site or application root to the directory you designated as the root of the site.
  • Unlock the sections of the web config as below
$appcmd = "$env:windir\system32\inetsrv\appcmd.exe" 
& $appCmd unlock config -section:access
& $appCmd unlock config -section:anonymousAuthentication
& $appCmd unlock config -section:basicAuthentication
& $appCmd unlock config -section:windowsAuthentication

 

Now we need to set up the location where the pull server content will be served from.  Installing the DSC Service feature creates a default location ( $env:programfiles\WindowsPowerShell\DscService ).  There’ll you find sub-directories for configuration and modules.  We can use these folders or we can create another location.  I’m going to stick with the defaults for now.  We’ve got a few steps left.

First, we need to copy the Devices.mdb from $pshome/modules/psdesiredstateconfiguration/pullserver to the root of our pull server data location (in this case, $env:programfiles\WindowsPowerShell\DscService )

Update the web.config app settings with the following settings:

<add key="dbprovider" value="System.Data.OleDb" />
<add key="dbconnectionstr" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\WindowsPowerShell\DscService\Devices.mdb;" />
<add key="ConfigurationPath" value="C:\Program Files\WindowsPowerShell\DscService\Configuration" />
<add key="ModulePath" value="C:\Program Files\WindowsPowerShell\DscService\Modules" />

After that your pull server should be up and running.  You should see something like this if you navigate to http://yourpullserver/psdscpullserver.svc

PullServerDefaultUrl

 

 

Up Next: Jason Helmick on the 2013 PowerShell Summit and his upcoming IIS book!


This Thursday we’ll be speaking to Jason Helmick from Interface Technical Training about his upcoming book from Manning Press which is titled, Learn Windows IIS in a Month of Lunches. The book won’t ship until the Spring of 2013, but you can get early access from Manning today.

Also on the agenda, Jason is going to announce plans for the 2013 PowerShell Summit which is the community-organized succession to the very popular PowerShell Deep Dive summits from the past two years.

Be sure to join us live every Thursday at 9:30 PM EDT at live.powerscripting.net!

Windows PowerShell Web Access – Installation guide II


This blog is a continuation of the post on Basic installation guide for PowerShell Web Access. In the basic installation blog, we configured IIS with the default values used by the Install-PswaWebApplication cmdlet. This is the simplest way to install and configure the feature.

 

The video below illustrates two more ways to configure IIS –

1. Using Install-PswaWebApplication

     In this case we specify values for –WebSiteName and –WebApplication parameters for the cmdlet

2. Using the GUI equivalent

     In this case, we use IIS Manager to configure the website and the web application pool.

 

Detailed instructions on different ways to configure IIS can also be found in the Windows PowerShell Web Access help document.

The video also briefly describes how the events are logged for PowerShell Web Access. Admins can use this information to troubleshoot login failures.

 

Kriti Jindal

Program Manager

Windows PowerShell Web Access

Microsoft Corporation

Windows PowerShell Web Access – Installation guide II


This blog is a continuation of the post on Basic installation guide for PowerShell Web Access. In the basic installation blog, we configured IIS with the default values used by the Install-PswaWebApplication cmdlet. This is the simplest way to install and configure the feature.

 

The video below illustrates two more ways to configure IIS –

1. Using Install-PswaWebApplication

     In this case we specify values for –WebSiteName and –WebApplication parameters for the cmdlet

2. Using the GUI equivalent

     In this case, we use IIS Manager to configure the website and the web application pool.

 

Detailed instructions on different ways to configure IIS can also be found in the Windows PowerShell Web Access help document.

The video also briefly describes how the events are logged for PowerShell Web Access. Admins can use this information to troubleshoot login failures.

 

Kriti Jindal

Program Manager

Windows PowerShell Web Access

Microsoft Corporation

Episode 23 – IIS7 Special


A Podcast about Windows PowerShell.

Listen:

In This Episode

  • Today we’ve got an interview with a senior program manager from the IIS team at Microsoft.  We’ve also got news, resources, and a bunch of PowerShell tips for you.

News

The News today is sponsored by SDM Software:
“SDM Software provides innovative solutions that combine PowerShell and Group Policy to help reduce the complexity of managing your Windows systems.  Their unique GPExpert Scripting Toolkit for PowerShell, provides the means to automate the management of your Group Policy Objects. To get more information about these products and download trial copies, visit sdmsoftware.com/powerscripting.php.”

  • Reports are coming in from MVPs right and left that the things they learned about the AD teams forthcoming PowerShell support echoes what were heard in our interview with Jeffery Snover.
  • Thanks to Andrew Westgarth who blogged about some really cool IIS7 news.  There’s a “Tech Preview” now available for a PowerShell provider to manage your IIS server.  Very cool possibilities.  Download and overview are on blogs.iss.net, and on learn.iss.net they have several walkthroughs.
  • Pash – a cross platform open source reimplementation of PowerShell has been released
  • And thanks also to Mark Schill for this one: “Citrix has released some cmdlets for use with their XenServer virtualization product. No where near as powerful as VMWare’s cmdlets, but at least its a start. You can check them out and get more information at this URL.”
  • Windows PowerShell Virtual User Group Meeting #5 happened on April 22
    • Bart DeSmet (Microsoft) gave a cool presentation of script cmdlets
    • Steven Nelson talked briefly about Powershell documentation – PowerShell videos are coming
    • Look for the download at http://MarcoShaw.blogspot.com

Interview

Our interview today is brought to you by Quest Software.
Quest LOVES PowerShell. Go to www.quest.com / PowerShell and download their free graphical user interface, script editor and Active Directory cmdlets. While you’re there, join their online community where you can share ideas and download free PowerPacks to extend PowerGUI.  Visit www.quest.com / powershell today!

Today we speak with Thomas Deml from Microsoft.  He is the Senior Program Manager in the IIS team.  He’s been with MSFT for 17 years!  Old timer. His team “owns” the core engine of IIS and the PS provider is a subset of that.  Below are some notes from the interview.

  • Who are you
  • What’s your background at MS and elsewhere
  • Talk about the IIS7 management cmdlets
    • Get/Set-WebConfiguration
    • Start-WebItem
    • Remove-WebConfigurationProperty
    • Ability to use XPath filters
  • Talk about the IIS7 PSprovider
    • Provider timeline – 2nd beta in June, final in October
    • Features
      • ability to configure IIS and ASP.net, sites, vdirs, apps, all that
      • ability to delegate
      • root of namespace: sites, app pools
  • What does the future hold (that you can discuss)
    • We talk about Server Core

Resources

Tips

  • This came up on #PowerShell (on freenode.net): How can I remove an item from a collection?
    For example “$servers = get-QADComputer srv*”.

    • Option 1 – Set the item to $null.  This does not actually remove the item, but for most purposes it serves well.
      • $servers[3] = $null
    • Option 2 – Create a new collection which is a subset of the first.  Drawback here is double the memory as the collection is copied in place.
      • $servers = $servers -ne “itemthatyouwantremoved”
    • Option 3 – Use system.collection.arraylist instead of a generic array.  More steps, but the item or items are removed, and it much more efficient than option 2.  The Scripting Guys explain it well in one of their PowerShell tipsof the week.
      • $servers = new-object system.collection.arraylist; $servers.Remove(“item”)
  • PowerShell Power User Tips: Current Directory – The core of this tip is very simple: Windows tracks your application’s “current directory” … and you can get and set this location using static methods of the System.IO.Directory class: SetCurrentDirectory and GetCurrentDirectory.  (Thanks Jaykul of Huddledmasses.org.)
  • Newsgroup posts
    • Excel Row Format” – In this thread, Oisin explains how to teach yourself how to automate Excel by examining vbscript created by the macro recorder.
  • This snippet is from Chris in Charleston, SC.  He sent a long email with feedback (which you all should do) with several suggestions.  Thanks, Chris!  This tip is that it’s quite easy to integrate the old with the new in PowerShell.  He’d also found that grep.exe in some cases is much faster than select-string, so it was a good example for his point.  Jonathan’s test had Grep for Windows 2:30 and Select-String 11:08 against the same 6.7 GB log file.
    • $cmd = “grep.exe `”$username`” $logfile”
      Invoke-Expression $cmd | Set-Content F:4report$username.txt
  • Don Jones post “Include in PowerShell” dot source a PS1 file at the beginning of your script – http://blog.sapien.com/index.php/2008/04/08/include-in-powershell/