New-WebVirtualDirectory - Cannot retrieve dynamic parameters for the cmdlet, Class not registeredRSS

4 replies

Last post Mar 06, 2014 01:07 PM by tadmaz

  • New-WebVirtualDirectory - Cannot retrieve dynamic parameters for the cmdlet, Class not registered

    Feb 27, 2014 11:43 AM|tadmaz|LINK

    Hi,

    I'm getting an error every other time I run a command to create a virtual directory.  2012 R2, IIS 8.5  What is going on here?  If I run the command once I get this error.  If I run it again it works fine.  If I delete the virtual directory and run it again I get the error, run it again and it's fine.  And so on...

    Both commands do the same thing.

    New-WebVirtualDirectory -Site "Default FTP Site" -Name "SAMPLEDIR" -PhysicalPath "F:\SAMPLEDIR"

    new-item "IIS:\Sites\Default FTP Site\SAMPLEDIR" -type VirtualDirectory -physicalPath "F:\SAMPLEDIR"

    Error: 

    New-WebVirtualDirectory : Cannot retrieve the dynamic parameters for the cmdlet. Class not registered (Exception from RESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
    At line:1 char:1
     New-WebVirtualDirectory -Site "Default FTP Site" -Name "SAMPLEDIR" -PhysicalPath "F: ...
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo          : InvalidArgument: (:) [New-WebVirtualDirectory], ParameterBindingException
       + FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.IIs.PowerShell.Provider.NewVirtualDirectoryCommand

  • Re: New-WebVirtualDirectory - Cannot retrieve dynamic parameters for the cmdlet, Class not regist...

    Mar 05, 2014 12:44 AM|Angie xu - MSFT|LINK

    Hi tadmaz

    Welcome to IIS forum.

    To create a Virtual Directory you also use the New-Item cmdlet. Create a Virtual Directory underneath the 'Default Web Site' but and a second one underneath the Web Application we created in the previous step.

    For further informaton:

    PowerShell Snap-in: Creating Web-Sites, Web applications, Virtual Directories and Application Pools

    If it still has same issue after use the method above, please let me know, and we will look into it furtherly.

    Best regards

    Angie Xu

    Angie xu

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: New-WebVirtualDirectory - Cannot retrieve dynamic parameters for the cmdlet, Class not regist...

    Mar 05, 2014 10:11 AM|tadmaz|LINK

    Hi Angie, I don't think you read my post very carefully.  I'm trying both "New-WebVirtualDirectory" and "new-item".  Both cmdlets have the same issue.  The first time I run the command I get an error, if I up-arrow and press enter it always works the second time.  I've built countless 2012 R2 servers and they all exhibit this behavior.

  • Re: New-WebVirtualDirectory - Cannot retrieve dynamic parameters for the cmdlet, Class not regist...

    Mar 05, 2014 12:43 PM|tadmaz|LINK

    I figured out my own issue!  I was installing literally just "FTP Server" and "IIS Management Console".  I noticed that the DefaultAppPool was defunct with a red X, so I experimented and determined that by installing "Web Server\Application Developement\Application Initialization" the apppool looks ok, then the new-webvirtualdirectory commands work the first time around now!  Wow!

  • Re: New-WebVirtualDirectory - Cannot retrieve dynamic parameters for the cmdlet, Class not regist...

    Mar 06, 2014 01:07 PM|tadmaz|LINK

    In the end, the new-webvirtualdirectory cmdlet only works the first time around if there is an apppool.  An apppool needs the WAS service (Windows Process Activation Service).  When you install any IIS feature it installs its own WAS service.  You can install the WAS service as a Windows Feature separately, then the apppool is there but won't start unless you start the WAS service manually.  Even with the apppool stopped, the new-webvirtualdirectory cmdlet works fine.  I found a microsoft article stating that generally you should not install the WAS service as a windows feature, so I will continue just installing "Web Server\Application Developement\Application Initialization".

    http://technet.microsoft.com/en-us/library/cc770745.aspx

    IIS and .NET Framework 3.5.1 automatically install Windows Process Activation Service as needed. You should not install Windows Process Activation Service by itself.