From a6830ada57f46c2485230f29fd9fa958d3a31365 Mon Sep 17 00:00:00 2001 From: Nicole Rappe Date: Thu, 13 Mar 2025 18:16:23 -0600 Subject: [PATCH] Update Servers/Automation/Ansible/Enable WinRM on Windows Devices.md --- Servers/Automation/Ansible/Enable WinRM on Windows Devices.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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