Link to home
Start Free TrialLog in
Avatar of ckelsoe
ckelsoeFlag for United States of America

asked on

Set-Location IIS:\AppPools Error

HI,

I am spending a lot of time trying to figure out why a PowerShell will not run on a new server. The offending line of code is "Set-Location IIS:\AppPools" .

When running PowerShell ISE 32 bit I get this error:
Set-Location : Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154 Class not registered (Exception 
from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At C:\Temp\PowerShell Temp\BPR App Pool.ISE.ps1:47 char:1
+ Set-Location IIS:\AppPools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-Location], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.SetLocationCommand

Open in new window


Note that I have tried importing WebAdministration although that does not seem to be a requirement when working on the same OS on a different server. Note the server OS is Server 2012 R2 X64.

When I try the same command in PowerShell ISE x64 I get the following error:
Set-Location : Cannot find drive. A drive with the name 'IIS' does not exist.
At line:1 char:1
+ Set-Location IIS:\AppPools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (IIS:String) [Set-Location], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Open in new window


I then drop back to the PowerShell (X86)  and PowerShell X64 command prompt and enter Set-Location IIS:\AppPools and get this error:
Set-Location : Cannot find drive. A drive with the name 'IIS' does not exist.
At line:1 char:1
+ Set-Location IIS:\AppPools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (IIS:String) [Set-Location], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Open in new window


What am I missing that is causing the errors? I am especially interested in the Class not registered error. Googling has returned some results with no definitive working answer. I have tried those solutions.

The same commands work fine on another system that appear to be identical in configuration.

Thanks for any insight and help.
Avatar of Qlemo
Qlemo
Flag of Germany image

PS x86 (no ISE) behaves the same? That would be very strange.

The "Class not registered" error occurs if the registry info in the HKEY_Class_Root key is incomplete. The name-to-GUID reference has been found there, but the entries corresponding to that GUID (which is an own key in the registry) are missing. Those missing entries contain the name of the DLL to use, for example, and other parameters.
There is a remote possibility that the key is ok, but the DLL is not found - I'm not positive whether this would show the same error.

Maybe you should just try to install IIS.
Avatar of ckelsoe

ASKER

"Maybe you should just try to install IIS." - I even tried plugging in the server before turning it on.

PS C:\Windows\system32> Import-Module Servermanager
PS C:\Windows\system32> Add-WindowsFeature Web-Server -IncludeAllSubFeature

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             NoChangeNeeded {}

Open in new window

Can you try to de- and re-install the feature?
Avatar of ckelsoe

ASKER

Ok - I did a uninstall and reinstall of all IIS features. That has made no difference.

I think part of the issue is that the WebAdministration stuff does not appear to work in PowerShell 32-bit.  That really does not make a lot of sense. Adding to the confusion is there does not seem to be a way to validate which version of ISE I am using (32 vs 64).
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for closing, but do you think a "B" grade is justified?
Avatar of ckelsoe

ASKER

The solution to this issue is to run the X64 version of PowerShell ISE. IT is not obvious which version of PowerShell ISE you are in from looking at the PowerShell ISE user interface (Unlike the standard PowerShell prompt which clearly indicates X32 or not).
Of course it is obvious, there is no difference if using PS or ISE:User generated image
Avatar of ckelsoe

ASKER

Thank you for clarifying that Qlemo. I was incorrect in my previous statement. I apologize.
So you have been confused by not seeing that (visible) difference? That stands to reason then ...
Avatar of ckelsoe

ASKER

Yes it does. I never saw the X32 marking thus the ISE instance I was in was the X64 version. Which means that the issue should never have occurred since this was a X64 OS and I was in X64 ISE. In the initial post the error was documented (a different error) based on which PowerShell command prompt I was in - X32 or X64. Unfortunately I cannot go back to that VM as I reverted to an earlier snapshot and no longer have that instance available.