How generate C# class using mgmtclassgen command for IISWebInfo ??
I test like this:
C:\Temp>mgmtclassgen Win32_LogicalDisk
/n root\cimv2 /l CS /p c:\disk.cs
Microsoft (R) .NET Framework Version
3.5.21022.8 Copyright (C) Microsoft Corporation. All rights reserved.
Generating Code for WMI Class
Win32_LogicalDisk … Code Generated
Successfully!!!!C:\Temp>mgmtclassgen IISWebInfo /n
root\cimv2 /l CS /p c:\disk2.cs
Microsoft (R) .NET Framework Version
3.5.21022.8 Copyright (C) Microsoft Corporation. All rights reserved.
Getting the given class FailedC:\Temp>mgmtclassgen IIsWebInfo /n
root\cimv2 /l CS /p c:\disk2.cs
Microsoft (R) .NET Framework Version
3.5.21022.8 Copyright (C) Microsoft Corporation. All rights reserved.
Getting the given class FailedC:\Temp>mgmtclassgen IIsWebInfo /n
root\MicrosoftIISv2 /l CS /p
c:\disk2.cs Microsoft (R) .NET
Framework Version 3.5.21022.8
Copyright (C) Microsoft Corporation.
All rights reserved. Errors
Occurred!!!! Reason : Espacio de
nombres no válido
the
IIsWebInfoclass is present in theroot\MicrosoftIISv2namespace. so you must check which this namespace exist in your system.this error message
Errors Occurred!!!! Reason : Espacio de nombres no válidomeans which the namespace does not exist in your system.you can found more information in this link
Connecting to the IIS WMI Provider