2

I'm writing a small web application that will run some powershell scripts on the localhost to create new IIS sites etc. I have the script working fine in ISE 64 bit but when trying to run them in 32 bit I'm getting errors like:

Get-ChildItem IIS:\Sites
Get-ChildItem : Cannot retrieve the dynamic parameters for the cmdlet. Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154.

I've tried downloading the x86 version of the snap-in but the installer stops telling me to use 'Programs and Features' to install it which I've tried but cant find what's not enabled that should be.

This is an issue as the .NET application seems to run the scripts in the 32 bit powershell so my 2 questions are:

  1. Can I run these scripts in 64 bit from .NET
  2. Can I install these snap ins in 32 bit on a 64 bit OS
2
  • still haven't found a solution to this unfortunately although the project has been put on hold for now Commented May 31, 2012 at 21:53
  • Depending on the windows server OS, the WebAdministration module/snapin may not be present. See related SO post. Commented May 28, 2015 at 16:47

1 Answer 1

1

PowerShell installs both the 32-bit and 64-bit WebAdministration modules. When you create your runspace, are you executing Import-Module WebAdministration before attempting to use the IIS: drive (provider)?

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah I'm running the same script in Powershell 32 and 64. If I just use a simple script like the following: import-module WebAdministration; Get-Website | Where {$_.Name -eq "ExampleSite"} I get: Get-Website : Retrieving the COM class factory for component.... Works fine in 64 bit powershell
Are you running as admin (elevated if on Vista/Win7 with UAC enabled). In C# exe, what apartment is Main decorated with (STA or MTA)? Also try setting your app's Platform Target to x64 and see if it works on yrou x64 system. If that works and you need to support both x86 and x64, try setting the Platform Target to AnyCPU. BTW other folks have run into this issue. See forums.iis.net/t/1163290.aspx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.