pluralsight / PS-AutoLab-Env

A PowerShell module for creating lab configurations using Lability and Desired State Configuration. Look at README.md for more information.
MIT License
269 stars 74 forks source link

Dynamically Update Trusted Hosts #189

Open jdhitsolutions opened 5 years ago

jdhitsolutions commented 5 years ago

The current version adds <local> to the TrustedHosts configuration. It would be better if this were dynamically updated depending on the configuration you are running. This will also likely fail if this setting is controlled with Group Policy so that needs to be addressed as well.

montge commented 4 years ago

Not sure if this the same issue, but I'm unable to get things to work, via the Unattend-Lab or Setup-Lab, the machine had previously the 3.x version, which wasn't working as I had to upgrade to Windows 10 Pro so Hyper-V, by the time I got back, it appears that things had been migrated to 4.3.x

Below are the outputs, let me know if we should track under separate ticket. I am escalating to Administrator rights for powershell, and this account is one of the ones tied to a Microsoft Login.

Unattend-Lab                                                                    
[<HOSTNAME>] Connecting to remote server <HOSTNAME> failed with the following error message : WinRM cannot    process the request. The following error with errorcode 0x8009030e occurred while using Negotiate authentication: A     specified logon session does not exist. It may already have been terminated.                                             Possible causes are:                                                                                                     -The user name or password specified are invalid.                                                                       -Kerberos is used when no authentication method and no user name are specified.                                         -Kerberos accepts domain user names, but not local user names.                                                          -The Service Principal Name (SPN) for the remote computer name and port does not exist.
  -The client and remote computers are in different domains and there is no trust between the two domains.
 After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or
use HTTPS transport.
 Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command: winrm help config. For more
information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (<HOSTNAME>:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : 1312,PSSessionStateBroken

Setup-Lab Fails as below

Set-LabVMDiskFileResource : Cannot bind argument to parameter 'VhdDriveLetter' because it is an empty string.
At line:82 char:74
+ ... MDiskFileResource @PSBoundParameters -VhdDriveLetter $vhdDriveLetter;
+                                                          ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Set-LabVMDiskFileResource], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Set-LabVMDiskFileResource

I do see when I run Setup-Lab in the Hyper-V Manager the 4 hosts being created. When trying to manually start they all try to start. Shutdown-Lab and Wipe-Lab seem to work after that.

jdhitsolutions commented 4 years ago

Did you follow the guidelines on removing the previous version of Autolab? What is the result when you run Get-PSAutolab setting? What is the value of TrustedHosts? You can run (get-item WSMan:\localhost\Client\TrustedHosts).value and X out any computer names or internal IP addresses. And please open this as a separate issue.

montge commented 4 years ago

I'm wondering if there are other issues going on. I was able to get past the Enable-Internet but when I got to validation step it looks like DC1 wasn't configured. I had to go in and type in a password, as the validation steps were showing the password was invalid. After fixing that the validation script running manually was showing invalid configs. Positing in new issue.