Closed DanAtkinson closed 5 years ago
@DanAtkinson When using this module with Windows PowerShell on the same machine it works?
@SteveL-MSFT If I run it from my normal PowerShell, I get the following:
PS D:\> Import-WinModule WebAdministration
Import-WinModule : The term 'Import-WinModule' 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:1
+ Import-WinModule WebAdministration
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Import-WinModule:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
If I run Get-WebRequest
, I'll get a full breakdown of the current requests (apart from the url
and hostname
which have been redacted).
requestId : ef0000008000015b
connectionId : ef00000060000150
verb : GET
url : /<redacted>
siteId : 3
localPort : 80
hostName : <redacted>.com
clientIpAddress : 127.0.0.1
timeElapsed : 172
pipeLineState : 32
timeInState : 172
currentModule : Session
timeInModule : 172
localIpAddress : 127.0.0.1
Attributes : {requestId, connectionId, verb, url...}
ChildElements : {}
ElementTagName : request
Methods :
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
Output of $PSVersionTable:
Name Value
---- -----
PSVersion 5.1.17763.316
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.316
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
@DanAtkinson did you run Enable-PSRemoting
from Windows PowerShell on that machine?
@SteveL-MSFT Yes, that appears to have been the problem. I'm not sure why I needed to enable it if I'm only checking local connections, and Windows PowerShell doesn't complain.
Either way, the problem does appear to be resolved now. Thank you!
D:\
λ powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS D:\> Enable-PSRemoting
WinRM is already set up to receive requests on this computer.
WinRM is already set up for remote management on this computer.
PS D:\> exit
λ D:\PowershellCore\pwsh
PowerShell 6.2.0
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS D:\> [bool](Test-WSMan -ComputerName $env:COMPUTERNAME -ErrorAction SilentlyContinue)
True
PS D:\> Import-WinModule WebAdministration
PS D:\> Get-WebRequest
PS D:\>
It might be worth asking users to run [bool](Test-WSMan -ComputerName $env:COMPUTERNAME -ErrorAction SilentlyContinue)
beforehand in order to check that remoting is enabled.
I posted an issue on the PowerShell Core board regarding the inability to use
Get-WebRequest
with PowerShell Core.A suggestion that was provided was to install the
WindowsCompatibility
module. However, I tried this and it failed.I checked and IIS is set up just fine, has several sites running on it and the default site is still there. I can also browse to it without problems.
Am I missing something? Should this not just work?
Output from
$PSVersionTable
.