Win_hostname module: Change name check to WMI (#56420)

* Change name check to WMI

* Changelog fragment

* Fixed per review
pull/57091/head
ShachafGoldstein 5 years ago committed by Jordan Borean
parent 35c8739c2a
commit 94566ed79c

@ -0,0 +1,2 @@
bugfixes:
- "win_hostname - Fix non netbios compliant name handling (https://github.com/ansible/ansible/issues/55283)"

@ -11,7 +11,8 @@ $params = Parse-Args $args -supports_check_mode $true
$name = Get-AnsibleParam -obj $params -name "name" -type "str" -failifempty $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$current_computer_name = $env:ComputerName
$current_computer_name = (Get-CimInstance -Class Win32_ComputerSystem).DNSHostname
$result = @{
changed = $false
old_name = $current_computer_name

Loading…
Cancel
Save