Modified setup.ps1 in order to show Windows Installation type (#41002)

* Modified setup.ps1 in order to show Windows Installation type

* Fix after pull request comment

* Added changelog fragment
This commit is contained in:
Gianluca 2019-11-15 02:19:01 +01:00 committed by Jordan Borean
parent 4f51b7d323
commit bf8fe221bf
2 changed files with 10 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- windows setup - Added ``ansible_os_installation_type`` to denote the type of Windows installation the remote host is.

View file

@ -207,6 +207,13 @@ if($gather_subset.Contains('distribution')) {
default { "unknown" }
}
$installation_type = $null
$current_version_path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
if (Test-Path -LiteralPath $current_version_path) {
$install_type_prop = Get-ItemProperty -LiteralPath $current_version_path -ErrorAction SilentlyContinue
$installation_type = [String]$install_type_prop.InstallationType
}
$ansible_facts += @{
ansible_distribution = $win32_os.Caption
ansible_distribution_version = $osversion.Version.ToString()
@ -214,6 +221,7 @@ if($gather_subset.Contains('distribution')) {
ansible_os_family = "Windows"
ansible_os_name = ($win32_os.Name.Split('|')[0]).Trim()
ansible_os_product_type = $product_type
ansible_os_installation_type = $installation_type
}
}