Windows PowerShell Snap-In for IIS fails on 32-bit?

system runtime interopservices comexception microsoft iis powershell provider getwebsitecommand
powershell class not registered

I'm trying to write a PowerShell script that will automate my IIS website deployments. I'm trying to run the scripts on my Windows Server 2008 R2 machine, under 32-bit in:

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

Whenever I run a WebAdministration command such as this:

Get-Website -Name "MYWebsite"

I get an error like this:

Get-Website : Retrieving the COM class factory for component with CLSID {688EEE
E5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154.
At line:1 char:12
+ Get-Website <<<<  -Name "MyWebsite"
    + CategoryInfo          : NotSpecified: (:) [Get-Website], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Micr
   osoft.IIs.PowerShell.Provider.GetWebsiteCommand

Switching to the 64-bit version of PowerShell.exe resolves this issue but makes it impossible for me to also use the Microsoft Team Foundation Server 2008 Power Tools PSSnapin, which is a no-go for me.

Any idea how I can overcome this? Thanks in advance.

Just to connect the dots. "urig" answered his own question in another topic: TFS Power Tools 2008 Powershell Snapin won't run in on 64-bit in Windows 2008 R2

"Cathy Kong of Microsoft was kind enough to provide me with a workaround for this issue. The full details can be found here in the MSDN TFS PowerTools forum: http://social.msdn.microsoft.com/Forums/en-US/tfspowertools/thread/a116799a-0476-4c42-aa3e-45d8ba23739e/?prof=required

The fix is as follows and worked well for me:

Please save the following content and save it as *.reg file and import to Registry(just double click the *.reg file, click OK double)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.TeamFoundation.PowerShell] "PowerShellVersion"="2.0" "Vendor"="Microsoft Corporation" "Description"="This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "VendorIndirect"="Microsoft.TeamFoundation.PowerShell,Microsoft" "DescriptionIndirect"="Microsoft.TeamFoundation.PowerShell,This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "Version"="10.0.0.0" "ApplicationBase"="C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools" "AssemblyName"="Microsoft.TeamFoundation.PowerTools.PowerShell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" "ModuleName"="C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\Microsoft.TeamFoundation.PowerTools.PowerShell.dll" "CustomPSSnapInType"="Microsoft.TeamFoundation.PowerTools.PowerShell.TFPSSnapIn"

Is WebAdministration module for X64 bit programs only, If not, please start a 32-bit version of Windows Powershell. .com/questions/​3501001/windows-powershell-snap-in-for-iis-fails-on-32-bit. To install IIS PowerShell Snap-in: The IIS PowerShell Snap-in is available as x86 and x64 version. Download the 32-Bit version or 64-Bit version. Run the MSI file to install the IIS PowerShell Snap-in. To use the IIS PowerShell Snap-in. PowerShell snap-ins like the IIS PowerShell Snap-in have to be registered with PowerShell. There are two ways to do this:

Running:

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe 

actually loads the 32 bit version of powershell ;-)

This obviously not what you want. Run the version in system32 to get the 64bit version. Yes, really.

You can verify this like:

ps> [intptr]::size
4

If it returns 4, it's 32 bit. 64 bit powershell will return 8.

-Oisin

Windows PowerShell Snap-In for IIS fails on 32-bit?, I'm trying to write a PowerShell script that will automate my IIS website deployments. I'm trying to run the scripts on my Windows Server 2008 R2 machine, under  The Windows PowerShell Provider for IIS 7.0 allows Web administrators and hosting providers to easily automate routine and complex IIS 7.0 administration tasks such as creating Web sites, and managing configuration and run-time data using Windows PowerShell.

One thing you might try is to load up a 64-bit PowerShell as Oisin says and then use Start-Job -RunAs32 to execute script that loads the TFS PowerTools snapin and executes the TFS cmdlets as necessary. Be sure to output an required info from the commands that run in the background job. Use Wait-Job to wait for it to complete then use Receive-Job to get the data from the 32-bit side back into your main 64-bit PowerShell session e.g.

PS> [IntPtr]::Size
8
PS> $job = Start-Job { [intptr]::size } -RunAs32
PS> Wait-Job $job

Id              Name      State      HasMoreData     Location     Command
--              ----      -----      -----------     --------     -------
3               Job3      Completed  True            localhost    [intptr]::size


PS> Receive-Job $job
4

Installing the IIS 7.0 PowerShell Snap-in, The IIS PowerShell Snap-in is available as x86 and x64 version. Download the 32-Bit version or 64-Bit version. Run the MSI file to install the IIS  Windows PowerShell is Microsoft's shell and scripting language. This short article provides a brief tour of Windows PowerShell and IIS. Reading this article, you gain a solid understanding of exactly what Windows PowerShell is, learn about the relationship between Windows PowerShell and IIS, and discover some of the ways in which Windows

For those finding this in the future, I'd like to add that you should double check how you launch powershell. I was getting the same error, and couldn't figure out why the solutions were all in reference to using the 64 bit version, when I thought I already was.

It turns out that because I was running powershell with a third party 32 bit launcher, powershell was falling back to the 32 bit executable, despite being launched from the system32 folder. Thanks to x0n for the method of confirming the version I was using, as this lead me to my solution.

Download IIS Powershell Snap-in (x86) from Official Microsoft , The Windows PowerShell Provider for IIS 7.0 allows Web administrators and hosting providers to easily automate routine and complex IIS 7.0  Just to connect the dots. "urig" answered his own question in another topic: TFS Power Tools 2008 Powershell Snapin won't run in on 64-bit in Windows 2008 R2 "Cathy Kong of Microsoft was kind enough to provide me with a workaround for this issue.

Opening powershell with the below command solved my issue :

%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe 

Just invoke the powershell 64 bit version with the above command and pass the script path with arguments to it.

windows server 2008, If x64, try loding the snapin from both x64 and x86 versions powershell. x64 is in C:\Windows\System32\WindowsPowerShell\v1.0 and x86 is in  The Web server has a modular design that enables you to customize a server by adding or removing modules to meet your specific needs. The Install IIS 8.5 on Windows Server 2012 R2 section describes how to install modules, and the Modules in IIS 8.5 section below describes the functionality that each module provides and which modules are installed by default.

Error using Get-WebSite in PreDeploy because of , Hi Paul, I have a Powershell error that only happens when I run a script through a Tentacle on one Windows 7 (64-bit) machine. The first “Get-WebSite” fails with the FileNotFoundException and the second one works fine! else { Write-Error "​Neither Web Administration module nor IIS Powershell snap-in are available. Install this extension or view additional downloads. The Windows PowerShell Snap-In for IIS 7.0 allows Web administrators and hosting providers to easily automate routine and complex IIS 7.0 administration tasks such as creating Web sites, and managing configuration and run-time data using Windows PowerShell.

PowerShell and IIS: 20 practical examples, IIS 7 and the WebAdministration "SnapIn"; IIS 7.5+ and the IIS 7 shipped with Windows Server 2008, but how is PowerShell installed? ($maxFailures)) { Write-Host ("Attempt $attemptCount of $maxFailures failed: " + $_. NET app must run as a 32-bit process even on 64-bit machines # set this to $true. We recommend that you configure IIS to use a 32-bit worker processes on 64-bit Windows. Not only its compatibility better than the native 64-bit, performance and memory consumption are also better. Set the Web server to enable this globally so that you do not need to set it for each application pool.

IIS WebAdministration module failing with 80040154, Apart from the normal stuff about the IIS 7 powershell module failing /3501001/​windows-powershell-snap-in-for-iis-fails-on-32-bit for some  microsoft windows powershell free download - Windows 10, Microsoft Windows PowerShell 1.0 for Windows XP, Microsoft Windows PowerShell 1.0 for Windows Server 2003, and many more programs

Comments
  • This was a clear answer that fixed the problem for me - stackoverflow.com/a/6872000/852806
  • No, the answer to the other question is not relevant here. One is about the TFS powershell snap-in not working under x64; this is about the IIS module not working under x86 as WOW64. Easily confused, but no.
  • I think the problem he's running into is that he wants to use the TFS Snapin (32-bit only) in conjunction with the WebAdmin module which appears to be 64-bit only.
  • Thanks again for setting me straight Keith. I've edited my question to reflect your correction. I'm still at a loss as to how I can get both the IIS PSProvider and the TFS Power Tools PSSnapin to work together. Any ideas?
  • I know of no way to load a 32-bit snapin in the same PowerShell session as a 64-bit snapin. With the exception of using a 32-bit background job as explained in my answer.