(Get-WebRequest).Count
An integer value indicating the number of active IIS requests that are currently being run.
Get-WebRequest : The term 'Get-WebRequest' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:2
+ (Get-WebRequest).Count
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-WebRequest:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Name Value
---- -----
PSVersion 6.2.0
PSEdition Core
GitCommitId 6.2.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
As per the documentation, Get-WebRequest should be valid. I appreciate that PowerShell core should be OS agnostic but there is no information on when it was dropped, why, or what to replace it with.
I think I understand the problem in that the WebAdministration module is not installed and, as such, this doesn't work.
I have tried installing the missing module with Import-Module WebAdministration but get the below error:
Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\WebAdministration.psd1' does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module -SkipEditionCheck' to ignore the compatibility of this module.
At line:1 char:1
+ Import-Module WebAdministration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026Administration.psd1:String) [Import-Module], InvalidOperationExcep
tion
+ FullyQualifiedErrorId : Modules_PSEditionNotSupported,Microsoft.PowerShell.Commands.ImportModuleCommand
Doing Import-Module WebAdministration -SkipEditionCheck results in the following error:
Import-Module : Could not load type 'System.Management.Automation.PSSnapIn' from assembly 'System.Management.Automation, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
At line:1 char:1
+ Import-Module WebAdministration -SkipEditionCheck
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
So is there really no way to access the WebAdministration modules from Windows PowerShell in PowerShell Core?
Thanks
PSSnapIns _predate_ PowerShell Modules by quite literal years and aren't supported anymore. I'm pretty sure they were deprecated with PS... version 2? Something along those lines?
PS Core isn't able to support them, as far as I'm aware.. and whoever makes that module should ideally have rectified that in the intervening decade since their deprecation. :confused:
@vexx32 The problem is that I can find no documentation on it either way. I've also had a look at the IISAdministration cmdlet which was only introduced a couple of years ago but with similar problems. Either this or WebAdministration would be fine but both have the same problems.
You're right, I'm seeing plenty of documentation on how to use them even up to 5.1, and I was under the impression they were supposed to be deprecated and replaced with modules since v2 or v3 of PowerShell.
Perhaps @SteveL-MSFT would know the history here. 馃槃
I have tried installing the missing module with Import-Module WebAdministration but get the below error
You need to install RSAT. And I'm not sure that this module is compatible with PowerShell Core. Although MSFT team announced that the next milestone will aim for even greater compatibility (over 90% of modules). Until that you could use https://github.com/PowerShell/WindowsCompatibility
Specifically, the WebAdministration module is likely one that will not be compatible with PSCore6 nor PS7. The reason is that the namespaces used by this module is not part of .NET Core 3.0. Workaround is to use WindowsCompatibility module
@iSazonov @SteveL-MSFT Thank you for the suggestion. I have tried using the WindowsCompatibility module but it doesn't appear to work. I have raised an issue on the WindowsCompatibility github.
Thank you anyway.