Jeff Gilbert's Web blog at myITforum.com

This posting is provided "AS IS" with no warranties, and confers no rights :-)

March 2009 - Posts

Customizing Configuration Manager 2007 Resource Explorer Icons

If you read the post on how to customize SMS 2003 Resource Explorer icons, then you'll have the history behind why I decided to figure this out. You probably also noticed that I said not to try those steps on Configuration Manager 2007 sites and wondered why.

After figuring out how Resource Explorer decides on which icon to display in SMS 2003, I started poking around a Configuration Manager 2007 installation…and noticed that the files I was looking for either didn't exist or didn't work the same way. Sure, you might find some of the files that I referenced for configuring SMS 2003 icons, but they won't help you out in this particular endeavor. Resource Explorer was recoded for Configuration Manager and changes were made to how these icons are assigned.

In fact, if you try to do it the other way, you'll end up with things like this in your resourceexplorer.log file:

The 'resource' (Microsoft.ConfigurationManagement.AdminConsole.UIResources.SMS_G_System_PHYSICAL_MEMORY.resources) was not found.\r\nSystem.Resources.MissingManifestResourceException\r\nCould not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.ConfigurationManagement.AdminConsole.UIResources.SMS_G_System_PHYSICAL_MEMORY.resources" was correctly embedded or linked into assembly "AdminUI.UiResources" at compile time, or that all the satellite assemblies required are loadable and fully signed.\r\n at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)

"Linked into assembly AdminUI.UiResources" …eh? what? After giving the log the 'what look' for about 30 seconds, I decided it was time to call for back up. Its times like these that make me happy to work on the team that I'm on—I just had to find the developer who made the changes and/or knew enough about the process to give me a hint. Luckily, that person appeared from the mists (OK, really the third floor of my office building) with all the answers I was looking for—cue Jun Wang 'developer extaordinaire'.

So, after some wise words from Jun, it became apparent that I should forget everything I knew about how to do this in SMS 2003. The files you should concern yourself with in Configuration Manager sites are the adminui.uiresources.dll and the managementclassdescriptions.xml files:

  • The adminui.uiresources.dll file (located at .\Microsoft Configuration Manager\AdminUI\bin\adminui.uiresources.dll) contains all of the icons used in Configuration Manager's implementation of Resource Explorer.
  • The managementclassdescriptions.xml (located at .\Microsoft Configuration Manager\AdminUI\XmlStorage\ConsoleRoot\managementclassdescriptions.xml) is the file that tells Resource Explorer which icon to display.

Important: As usual with "hacks" like this, the information in this post is in no way supported by Microsoft (or me) and should only be used at your own risk if you want to fancy up your Resource Explorer icons similar to how Flo tricked out her name tag on those insurance commercials on TV.

If you want to change the icon that is displayed for a particular inventory class, you need to pop open the managementclassdescriptions.xml file and change some .xml (make sure you back up the original first!). For this example, I just opened it with notepad.exe and scrolled down until I found the class I wanted to modify. In this example I'm using the CD-ROM class and the snippet in the .xml about it looks like this:

<ManagementClassDescription Name="SMS_G_System_CDROM" SuperclassName="SMS_G_System_Current"> 
  <ResourceAssembly>
    <Assembly>AdminUI.UIResources.dll</Assembly>
    <Type>Microsoft.ConfigurationManagement.AdminConsole.UIResources.SMS_G_System_CDROM.resources</Type>
  </ResourceAssembly>
<ImagesDescription>
 <ResourceAssembly>
   <Assembly>AdminUI.UIResources.dll</Assembly>
   <Type>Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources</Type>
 </ResourceAssembly>
 <ImageResourceName>System</ImageResourceName> 
 </ImagesDescription> 
  <Properties>
    <ManagementClassPropertyDescription Name="Availability" Type="Integer" />
    <ManagementClassPropertyDescription Name="Description" />
    <ManagementClassPropertyDescription Name="DeviceID" />
    <ManagementClassPropertyDescription Name="Drive" />
    <ManagementClassPropertyDescription Name="GroupID" Type="InvariantInteger" />
    <ManagementClassPropertyDescription Name="Manufacturer" />
    <ManagementClassPropertyDescription Name="MediaType" />
    <ManagementClassPropertyDescription Name="Name" />
    <ManagementClassPropertyDescription Name="ResourceID" Type="InvariantInteger" />
    <ManagementClassPropertyDescription Name="RevisionID" Type="InvariantInteger" />
    <ManagementClassPropertyDescription Name="SCSITargetID" Type="InvariantInteger" />
    <ManagementClassPropertyDescription Name="SystemName" />
    <ManagementClassPropertyDescription Name="TimeStamp" Type="DateTime" />
    <ManagementClassPropertyDescription Name="VolumeName" /> 
  </Properties>
</ManagementClassDescription>

There's a lot of information there, but we're really only concerned with the <ImagesDescription> section:

<ImagesDescription>
  <ResourceAssembly>
    <Assembly>AdminUI.UIResources.dll</Assembly>
    <Type>Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources</Type>
  </ResourceAssembly>
  <ImageResourceName>System</ImageResourceName>
</ImagesDescription>

See how the image description says to go look in the AdminUI.UIResources.dll file and grab the icon named System to display for the CD-ROM class in Resource Explorer? Luckily, the icons are listed in the .xml as names and not ID's so we don't have to open the .dll and poke around to find an icon we like, we can just peruse the .xml for a name that sounds like something we're after…how about CD_Rom? Changing System to CD_Rom for that <ImageResourceName> line, saving the .xml, and then restarting Resource Explorer returns this result:

Before: cdrom0    After: cdrom1 

That's better, and now you know how to change the default icons in Configuration Manager's version of Resource Explorer.

Adding custom icons is a bit more problematic. If you open the AdminUI.UIResources.dll file in Visual Studio, the icons are not listed the same way as they were in the SMS_RES1.dll file (the SMS 2003 .dll holding the icons) and you also can't add custom icon resources to that file. To add your own custom icons in Configuration Manager, you have to create a new .dll file, add your  icon to that file, and then properly reference your custom assembly and icon name in the managementclassdescriptions.xml file.

That seems just a little bit too complicated to me to throw in at the end of this blog post and I'll have to write that up seperately. So, until then, that's all I've got to say about changing Configuration Manager 2007 Resource Explorer icons.

~Jeff

 

Posted Saturday, March 14, 2009 8:30 PM by jgilbert | with no comments

Customizing SMS 2003 Resource Explorer Icons

I've done quite a bit of hardware inventory modifications in my time and while it's great to see the new information displayed in Resource Explorer, it has always kind of bothered me that the new classes always had the default icon while some of the other inventoried information had more descriptive, and lets face it, cooler looking icons. As I implemented more and more hardware inventory modifications, it also became a challenge for me to remember just how I pulled that information—was it a registry key, a NOIDMIF, a script…you get the idea. Wouldn't it be nice to have a custom icon to remind me where that data came from I thought. This issue would crop up every now and then which sent me on a wild goose chase looking around for a while on the net. I never really came across anything very helpful and eventually I'd move on to something else. While this is seemingly very minor issue, it has always bothered me that I couldn't figure it out. And then one fatefully day recently someone on the myITforum SMS e-mail list (subscribe here) had a problem that caused the non-default SMS 2003 Resource Explorer icons to revert to the standard default icons. Now my quest to change Resource Explorer icons had taken on new life, and actually had a basis in something useful in helping out someone, so it wasn't just a matter of me trying to do something cool in figuring this out.

Important: Before reading on, understand that the information in this post is in no way supported by Microsoft (or by me in general for that matter) and should only be used at your own risk. If you're not comfortable mucking about with the steps in this procedure and performing icon disaster recovery in the event something goes wonky, please do not attempt! If your icons are not broken and you aren't after the cool icon effects for whatever reason then it's probably not worth the risk.

Disclaimer out of the way, here's the good stuff. To understand how SMS 2003 decides which icon to display for hardware inventory information displayed in Resource Explorer, you need to have a clear understanding of the three pieces of this puzzle: the sms_res1.dll file, the sms_schm.mof file, and how this information is stored in WMI on the site server.

  • The sms_res1.dll file contains all of the icons that can be displayed by default, and is located in the <install drive>:\SMS\bin\i386 directory. This file contains around 300 icons and some other assorted information that I'm not going to talk about here because it's just not relevant. If you open up the .dll in Visual Studio you'll see something like the below snippet, and if you then expand the icon node, you'll see the list of icons that it is possible to pick and choose from when using a standard icon:

sms_res1.dll

  • The sms_schm.mof file is used to map each of the hardware inventory classes displayed in Resource Explorer to a specific icon stored within the sms_res1.dll file. It also lives in the <install drive>:\SMS\bin\i386 directory. Here you can see the part of the file where the CD-ROM information is assigned icon #316 in the SMS_RES1.dll file:

sms_schm.mof

  • The sms_schm.mof file stores mapped icon information for inventory classes in the IconDLL and IconID qualifiers for their respective WMI namespaces under root\sms\site_<site code> when it is compiled. You can see in the snippet below that the CD-ROM class is set to display icon #316 (the CD-ROM icon) in WMI and as stored in the SMS_RES1.dll file:

sms_g_system_cdrom

If you're looking in SMS 2003's Resource Explorer and see only the default icon for everything, then one of those three pieces has gone catawompus. To find the culprit, you can run a cursory visual check of the files to see if something has become corrupted. If it all looks OK, then back up all of these files to somewhere safe and recompile the sms_schm.mof file by opening up a command prompt, navigating to the directory that sms_schm.mof is located and then running this command: MOFCOMP sms_schm.mof. Restart the computer and Resource Explorer should be back to displaying the default, 'non-default' icons for those classes lucky enough to have been assigned one. If it isn't, then you might need to grab another copy of the sms_schm.mof file and/or sms_res1.dll file from the installation source files and try again. If that doesn't work, then your WMI might be corrupt or some other issue beyond the abilities of a blog post to help you and you need to burn a support call.

That issue resolved and out of the way, I decided that I would continue on my quest for custom icons in Resource Explorer. If all of the Resource Explorer icons are stored in the sms_res1.dll file and are called by the sms_schm.mof file then what's to stop me from changing a default icon to one of the other icons stored in the sms_res1.dll file? For that matter, what's to stop me from adding my own custom icons? Turns out, nothing lucky enough for me.

First things first, you need to find the icon that you want to use and it's associated IconID as listed in sms_res1.dll. To do this, you'll need to use Visual Studio to pop open the sms_res1.dll file and then poke around until you see an icon that you like. Take the icon's IconID (the number of the icon in the .dll), change the appropriate class IconID value in the sms_schm.mof file accordingly, and then recompile it.

That's great for pre-existing inventory classes, but what if you want to change the icon for a custom inventory class? No problem, just open up the sms_schm.mof file and add in a section at the bottom for your class. Below is the addition I made for the custom physical memory MOF edit to my sms_schm.mof file and you can use it as a template, just ensure the group name and class information matches your custom MOF edit:

[
SMS_Group_Name("Physical Memory"),
IconID(306),IconDLL("SMS_RES1.dll"), 
SMS_Class_ID("MICROSOFT|PHYSICAL_MEMORY|1.0")]

Class Win32_PhysicalMemory : SMS_Class_Template
{};

Having the custom physical memory class information displayed using one of the default icons is OK, but wouldn't it be nice to have the icon actually look like RAM? Easy enough, just add the snippet above for the class to the sms_schm.mof file and change the class IconID property to display the RAM icon as stored in sms_res1.dll (IconID: 306). Recompile the sms_schm.mof file on the site server and hopefully the icons change the next time you open or refresh Resource Explorer. If not, restart the server and then here's what you should see in Resource Explorer (before and after):

Before: memory0    After: memory1

Cool eh?

Using one of the predefined icons is handy, but if you don't see an icon that you like stored in sms_res1.dll, or you want to add your own custom icon for whatever reason, that's easy to do too. Using Visual Studio again, open up the sms_res1.dll file and add the icon of your choice to the file and save it. To do that, open the .dll in Visual Studio, right-click the Icon node, select Add Resource, ensure Icon is selected and then click Import. Browse to your favorite icon file and click open to add it. The new icon will appear in the list with an assigned ID and be highlighted in a box so you know which one you just added (remember the new IconID number!).

Next, make the appropriate changes to the sms_schm.mof file and compile it (MOFCOMP <path>\sms_schm.mof). Custom icons allow you to verify which classes are custom MOF edits and/or know where the custom class information came from depending on which icon you've decided upon for specific MOF editing techniques (registry, WMI, script, etc…). For example, this one came from a registry key:

memory2

Oops. That's not a registry icon (and didn't come from the registry either, but I'm using some poetic license here)! The registry icon is a default icon in the sms_res1.dll and wasn't very interesting to me, while Bill the Cat is one of my personal hero's. OK, kind of off-topic there, but it shows how you can use any icon that you want to and besides, couldn't the world use more Bill the Cat?

If you'd like to make an icon change, but don't want to permanently modify the sms_schm.mof file, then you can just go directly into WMI for that class and change the IconID to something more to your liking. If a class doesn't have the IconDLL or IconID qualifiers (both are required), just add them, but remember that recompiling the default sms_schm.mof file will result in the class displaying its original icon in Resource Explorer. Also know that at the top of the sms_schm.mof file is the #pragma autorecover command. That means if WMI is rebuilt on the site server for whatever reason, and you haven't made your changes in that mof file, the icons will all revert back to their installation defaults when the sms_schm.mof file is recovered.

So, there you go, mystery solved—for SMS 2003 sites. Don't even think about trying to use this post as a guide to change Resource Explorer icons for a Configuration Manager 2007 site as the process isn't exactly the same, but don't worry; I've got you covered on how to do that in another blog post that's coming soon.

~Jeff

 

Posted Saturday, March 14, 2009 2:03 AM by jgilbert | with no comments

Automating IIS 7 Installation to Support Configuration Manager 2007

If you've ever installed, or even thought about installing, a Configuration Manager site, or site system requiring IIS on a Windows Server 2008 computer then you've probably had a look at the How to Configure Windows Server 2008 for Site Systems help topic in the Configuration Manager 2007 Documentation Library and then spent some time installing and manually configuring IIS 7, then installing WebDAV for IIS 7, and then spent some more time configuring WebDAV afterwards. If you only have to do this one or two times it's not too big of a deal, but because I'm constantly installing Configuration Manager lab machines on Windows Server 2008, going through the motions of installing and configuring IIS 7 can get repetitive. Not to mention that I always seem to leave out a bit of the configuration that sends me back to installing a missing feature later. After about the thousandth time configuring IIS 7 manually, I thought to myself "there's got to be a way to script this and save some time". If you've had the same thought then this post is for you. After some looking around, I couldn't find the steps to install and configure IIS 7 to support Configuration Manager installations anywhere so I decided to just figure it out for myself (and consequently, for you as well Smile).

My first stop was figuring out how to install IIS 7 via the command line. Instead of using sysocmgr (used to install IIS 6), Windows Server 2008 has a handy server manager command-line tool that is used to install Windows Server 2008 roles and features (could be any role or feature you want and not just IIS btw). If you want to install a single role or feature then you can just use the command line, but when you need to install multiple roles or features, you have to create an .xml answer file. Sounds a little daunting, but it's really not too bad. I just used notepad to create an answer file using these instructions. I covered all of the requirements defined in the Windows Server 2008 How To topic in the documentation library for every possible requirement other than the last bit about modifying the requestFiltering section on BITS-enabled distribution point computers. Here's what I came up with:

<ServerManagerConfiguration
Action="Install"
xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1"> 
    <Role Id="Web-Server"/> 
    <RoleService Id="Web-Asp-Net"/> 
    <RoleService Id="Web-ASP"/> 
    <RoleService Id="Web-Windows-Auth"/> 
    <RoleService Id="Web-Metabase"/> 
    <RoleService Id="Web-WMI"/> 
    <Feature Id="BITS"/> 
    <Feature Id="RDC"/>
</ServerManagerConfiguration>

To kick off the IIS installation using just the answer file, open a command prompt (right-click command prompt and select run as administrator) and then enter a command in the format below. I saved the log file as a .log instead of a .txt so I could use SMS Trace to watch the IIS installation action progress in the log instead of the counter in the command shell window, but you don't have to):

ServerManagerCmd.exe -inputPath <answer.xml [-logPath <log.txt>]

After running that command, you should see something similar to this:

Installing IIS 7 

Moving along to WebDAV which I thought was going to be a bit more of a challenge. Not only do you need to install the applicable version of WebDAV (either x86 or x64), you also need to create an authoring rule and configure other settings post installation. Luckily, another tool came to my rescue: appcmd.exe. This tool allows you to configure IIS 7 settings from the command-line…handy.

Armed with an IIS 7 installation answer file and the servermanagercmd and appcmd tools, I was ready to write the script to automate the process. I also wanted the script to auto-generate the IIS 7 answer .xml file for me so I wouldn't have to carry around an extra file everywhere (those .xml files can get heavy and I'm not as young as I used to be). Before I get to the script though, here are some caveats if you're planning on using my script 'as is':

  • The script relies on having the applicable WebDAV installation .msi in the same directory that the script is started from (in my testing I put the script at the root of C:\ and used the x86 version)
  • The script assumes that everything is installed on the C:\ so if you're using a different drive you'll need to tweak the script as necessary
  • There is no error checking in the script as I am only planning on using this in my lab for clean installations
  • You can't use this script if you've already installed IIS 7 as it will fail to reconfigure IIS
  • This script is provided 'as is', your mileage may vary, test it in a lab to ensure it does everything you need it to before using it in production, etc...  

So without much futher adieu, here's the PowerShell script…what? Don't have powershell installed on your Windows Server 2008 computer? No problem, just do this, open a command prompt (run as administrator) and run: ServerManagerCmd –install powershell and then continue after PowerShell installs. To run the .ps1 you'll also need to relax the PowerShell script execution policy since this script won't be signed. To do that, open up PowerShell and run Set-ExecutionPolicy Unrestricted. This setting will allow you to run unsigned scripts, but will also lower security for running scripts unless you change the security setting to a higher level later.

OK, moving on, here come the scripts. I've shown how to do this using PowerShell, .vbs, and .bat, but I do not recommend C&P'ing these scripts as who knows what word-wrap as done to them. If you want to use these scripts, you should probably download the .zip containing all of them from here. The .zip contains the un-commented PowerShell (IIS7.ps1), visual basic script (IIS7.vbs), and a batch file (IIS7.bat) that all do the same thing except that you have to manually create the answer.xml file yourself when using the .bat.

Here's the PowerShell version. I've inserted comments in this post to tell you what is going on as the script progresses:

# All the write-output stuff is just to make the console output look nice
write-output ""
write-output "Creating IIS answer file"
# The next line creates the IIS 7 answer file named answer.xml located at the root of C:\ (where the script was started from). Out-null is my attempt to make PowerShell wait before moving on until this process completes
new-item -path C:\ -name answer.xml -type 'file' | out-null
# These add-content lines are used by PowerShell to write the answer.xml file with the required role and role services Id's
add-content -path answer.xml -value '<ServerManagerConfiguration'
add-content -path answer.xml -value 'Action="Install"'
add-content -path answer.xml -value 'xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">'
add-content -path answer.xml -value '    <Role Id="Web-Server"/>'
add-content -path answer.xml -value '    <RoleService Id="Web-Asp-Net"/>'
add-content -path answer.xml -value '    <RoleService Id="Web-ASP"/>'
add-content -path answer.xml -value '    <RoleService Id="Web-Windows-Auth"/>'
add-content -path answer.xml -value '    <RoleService Id="Web-Metabase"/>'
add-content -path answer.xml -value '    <RoleService Id="Web-WMI"/>'
add-content -path answer.xml -value '    <Feature Id="BITS"/>'
add-content -path answer.xml -value '    <Feature Id="RDC"/>'
add-content -path answer.xml -value '</ServerManagerConfiguration>'
write-output ""
# Here are the commands that write the script's progress to the command shell, use the newly created answer.xml file to install IIS 7, and write installation progress to c:\iisinstall.log
write-output "Installing IIS 7"
ServerManagerCmd.exe -inputPath c:\answer.xml -logPath c:\IISInstall.log | out-null
# This line just deletes the answer.xml file after ServerManagerCmd has finished with it
remove-item c:\answer.xml
write-output ""
# These lines write the script's progress to the command shell and run the applicable WebDAV installation command line
write-output "Installing WebDAV for IIS 7"
msiexec /i webdav_x86_rtw.msi /qn | out-null
write-output ""
# These lines write the script's progress to the command shell and use appcmd.exe to enable WebDAV
write-output "Enabling WebDAV"
c:\windows\system32\inetsrv\AppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /enabled:true /commit:apphost | out-null
write-output ""
# These lines write the script's progress to the command shell and use appcmd.exe to create and configure the required WebDAV authoring rule
write-output "Creating and configuring a WebDAV authoring rule"
c:\windows\system32\inetsrv\AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoringRules /"+[users='*',path='*',access='Read']" /commit:apphost | out-null
write-output ""
# These lines write the script's progress to the command shell and use appcmd.exe to configure the remaining required WebDAV properties
write-output "Configuring WebDAV"
write-output ""
write-output "    Allowing access to hidden files"
c:\windows\system32\inetsrv\AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost | out-null
write-output "    Allowing anonymous property queries"
c:\windows\system32\inetsrv\AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowAnonymousPropfind:true /commit:apphost | out-null
write-output "    Not allowing Custom properties"
c:\windows\system32\inetsrv\AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowCustomProperties:false /commit:apphost | out-null
write-output "    Allowing property queries with infinite depth"
c:\windows\system32\inetsrv\AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowInfinitePropfindDepth:true /commit:apphost | out-null
write-output "    Allowing hidden files to be listed"
c:\windows\system32\inetsrv\AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost | out-null
write-output ""
write-output ""
# These lines aren't really necessary, but I like the script to pause so I can ensure that it finished. It's also a cool reminder of how to do a .bat-style pause in PowerShell Big Smile 
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit

If all goes well, when you run the script you should see something like this:

PowerShell script installing IIS and WebDAV

Here's the same thing in vbscript:

wscript.echo ""
wscript.echo "Creating IIS 7 answer file"
wscript.echo ""
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\answer.xml") 
    objFile.WriteLine "<ServerManagerConfiguration" 
    objFile.WriteLine "Action= " & chr(34) & "Install" & chr(34) & "" 
    objFile.WriteLine "xmlns= " & chr(34) & "http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1" & chr(34) & ">" 
    objFile.WriteLine "    <Role Id=" & chr(34) & "Web-Server" & chr(34) & "/>" 
    objFile.WriteLine "    <RoleService Id=" & chr(34) & "Web-Asp-Net" & chr(34) & "/>" 
    objFile.WriteLine "    <RoleService Id=" & chr(34) & "Web-ASP" & chr(34) & "/>" 
    objFile.WriteLine "    <RoleService Id=" & chr(34) & "Web-Windows-Auth" & chr(34) & "/>" 
    objFile.WriteLine "    <RoleService Id=" & chr(34) & "Web-Metabase" & chr(34) & "/>" 
    objFile.WriteLine "    <RoleService Id=" & chr(34) & "Web-WMI" & chr(34) & "/>" 
    objFile.WriteLine "    <Feature Id=" & chr(34) & "BITS" & chr(34) & "/>" 
    objFile.WriteLine "    <Feature Id=" & chr(34) & "RDC" & chr(34) & "/>" 
    objFile.WriteLine "</ServerManagerConfiguration>"
objFile.Close
Set wshShell = CreateObject("Wscript.Shell")
wscript.echo "Installing IIS 7"
wshShell.Run "ServerManagerCmd.exe -inputPath c:\answer.xml -logPath c:\IISInstall.log", 0, true
wscript.echo ""
wscript.echo "Installing WebDAV for IIS 7"
wshShell.Run "msiexec /i webdav_x86_rtw.msi /qn", 0, true
Set wshShell = CreateObject("Wscript.Shell")
wscript.echo ""
wscript.echo "Enabling WebDAV"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd.exe set config " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoring /enabled:true /commit:apphost", 0,
true
wscript.echo ""
wscript.echo "Creating and configuring a WebDAV authoring rule"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd.exe set config " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoringRules /+[users='*',path='*',access='Read'] /commit:apphost", 0, true
wscript.echo ""
wscript.echo "Configuring WebDAV"
wscript.echo ""
wscript.echo "    Allowing anonymous property queries"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd set config " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoring /properties.allowAnonymousPropfind:true /commit:apphost", 0, true
wscript.echo "    Not allowing Custom properties"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd set config " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoring /properties.allowCustomProperties:false /commit:apphost", 0, true
wscript.echo "    Allowing property queries with infinite depth"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd set config " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoring /properties.allowInfinitePropfindDepth:true /commit:apphost", 0, true
wscript.echo "    Allowing hidden files to be listed"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd set cconfig " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost", 0, true
wscript.echo "    Allowing access to hidden files"
wshShell.Run "c:\windows\system32\inetsrv\AppCmd set config " & chr(34) & "Default Web Site/" & chr(34) & " /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost", 0, true
wscript.echo ""
wscript.echo ""
Set wshShell = Nothing
wscript.quit

…and again as a .bat file (create the answer.xml file in the same directory before running)

@ECHO OFF
Echo Installing IIS 7
start /wait ServerManagerCmd.exe -inputPath c:\answer.xml -logPath c:\IISInstall.log
Echo Installing WebDAV for IIS 7
start /wait msiexec /i webdav_x86_rtw.msi /qb
cd %Windir%\system32\inetsrv
Echo Enabling WebDAV
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /enabled:true /commit:apphost
Echo Configuring WebDAV
Echo Creating and configure a WebDAV authoring rule
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoringRules /+[users='*',path='*',access='Read'] /commit:apphost
Echo Allowing anonymous property queries
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowAnonymousPropfind:true /commit:apphost
Echo Allowing Custom Properties
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowCustomProperties:false /commit:apphost
Echo Allowing property queries with infinite depth
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowInfinitePropfindDepth:true /commit:apphost
Echo Allowing hidden files to be listed
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost
Echo Allowing access to hidden files
AppCmd set config "Default Web Site/" /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost
pause
@ECHO ON
exit

 Hopefully this helps get you going with Configuration Manager installations on Windows Server 2008 computers a little faster!

 

~Jeff

 

 

 

Posted Thursday, March 05, 2009 7:45 AM by jgilbert | with no comments