diff --git a/Servers/Automation/Ansible/Enable WinRM on Windows Devices.md b/Servers/Automation/Ansible/Enable WinRM on Windows Devices.md index 9b45ee3..97e3718 100644 --- a/Servers/Automation/Ansible/Enable WinRM on Windows Devices.md +++ b/Servers/Automation/Ansible/Enable WinRM on Windows Devices.md @@ -37,7 +37,7 @@ if ($existingListeners | Where-Object { $_.Transport -eq "HTTPS" }) { # Create a new HTTPS listener Write-Host "Creating a new HTTPS listener..." -$listenerCmd = "winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname=`"hyperv-host.local`"; CertificateThumbprint=`"$certThumbprint`"}'" +$listenerCmd = "winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname=`"$(Get-WmiObject -Class Win32_ComputerSystem).DomainName`"; CertificateThumbprint=`"$certThumbprint`"}'" Invoke-Expression $listenerCmd # Set TrustedHosts to allow connections from any IP address (adjust as needed for security) @@ -63,7 +63,7 @@ winrm set winrm/config/service '@{AllowUnencrypted="false"}' Write-Host "Configuring WinRM client to use Kerberos..." winrm set winrm/config/client/auth '@{Kerberos="true"}' -# Ensure the PowerShell execution policy is set to allow running scripts +# Ensure the PowerShell execution policy is set to allow remotely running scripts Write-Host "Setting PowerShell execution policy to RemoteSigned..." Set-ExecutionPolicy RemoteSigned -Force