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

* Change name check to WMI

* Changelog fragment

* Fixed per review
This commit is contained in:
ShachafGoldstein 2019-05-28 22:30:16 +03:00 committed by Jordan Borean
parent 35c8739c2a
commit 94566ed79c
2 changed files with 4 additions and 1 deletions

View file

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

View file

@ -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