LabBuilder icon indicating copy to clipboard operation
LabBuilder copied to clipboard

Install-Lab cmdlet want to start WinRM service

Open johlju opened this issue 8 years ago • 5 comments

Before submitting your issue for the LabBuilder project, please take a moment to provide the following details:

  • [x] Version of PowerShell you're using: 5.1.16251.1000
  • [x] PowerShell host you're using (eg. Console Host, ISE, Visual Studio): Console
  • [x] Operating system you're running: Windows 10.0.16251.1000
  • [x] Version of LabBuilder you're using (use Get-Module -Name LabBuilder): 0.8.3.1140

When running Install-Lab I got a question to start WinRM service (which was confusing 😄). But thought "oh well, start then", but that ended in an error.

VERBOSE: [12:06:48]: Setting VLAN on  network adapter LABBUILDER-DOMAINCLUSTERING.COM Domain Private Site A in VM 'LABBUILDER-DOMAINCLUSTERING.COM SA-DC1' to 2.

Start WinRM Service
WinRM service is not started currently. Running this command will start the WinRM service.

Do you want to continue?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
Get-Item : Cannot find path 'localhost\Client\TrustedHosts' because it does not exist.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\0.8.3.1140\lib\public\vm.ps1:1603 char:30
+ ... tedHosts = (Get-Item -Path WSMAN::localhost\Client\TrustedHosts).Valu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (localhost\Client\TrustedHosts:String) [Get-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

So I ran Enable-PSRemoting which also ended in a error.

PS > Enable-PSRemoting
WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.

Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150859113" Machine="localhost"><f:Message><f:ProviderFault provider="Confi
g provider" path="%systemroot%\system32\WsmSvc.dll"><f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150859113" Machine="PC01.company.local"><f:Message
>WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private an
d try again. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:116 char:17
+                 Set-WSManQuickConfig -force
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

Ended up to change network category for the vSwitch LABBUILDER-DOMAINCLUSTERING.COM Lab Management to 'Private' as it was set to 'Public'. When the interface had type 'Private' I run Enable-PSRemoting just to verify and after that Install-Lab worked without any problem.

Get-NetConnectionProfile -InterfaceAlias 'vEthernet (LABBUILDER-DOMAINCLUSTERING.COM Lab Management)'
# Get interface index from the previous command.
Set-NetConnectionProfile -InterfaceIndex 37 -NetworkCategory Private

johlju avatar Jul 30 '17 10:07 johlju

I run LabBuilder on Windows Server 2016 and did not get this error, even when the Internal network switch has category 'Public'. Started from a clean environment, with no networks configured in Hyper-V.
Maybe this is a problem on Windows 10 only, or the above was a problem with a 'Insider' version of Windows 10.

johlju avatar Sep 03 '17 10:09 johlju

Wow I've been slack in keeping these up-to-date (too much time on the resource kit :grin:). Really need to put some work in here!

PlagueHO avatar Jun 14 '18 10:06 PlagueHO

I haven't had time looking at it either, may not be a problem anymore (since it could have been a problem on that Win 10 insider version). 😃

johlju avatar Jun 15 '18 06:06 johlju

Windows 10 Pro (b18362) also stops when it tries to start WinRM with

Get-Item : Cannot find path 'localhost\Client\TrustedHosts' because it does not exist.
At C:\Program Files\WindowsPowerShell\Modules\LabBuilder\1.0.4.84\LabBuilder.psm1:5851 char:30
+ ... tedHosts = (Get-Item -Path WSMAN::localhost\Client\TrustedHosts).Valu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (localhost\Client\TrustedHosts:String) [Get-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

DennisL68 avatar Oct 30 '19 16:10 DennisL68

I just built a fresh lab with Win10 versions 1709 - 1909 and didn't receive this error. If you download the latest version of LabBuilder, can you try testing again? @DennisL68 @johlju

bruckect avatar Feb 10 '20 06:02 bruckect