Skip to content

Commit 46c158e

Browse files
Gianluanshulbehl
authored andcommitted
Modified setup.ps1 in order to show Windows Installation type (ansible#41002)
* Modified setup.ps1 in order to show Windows Installation type * Fix after pull request comment * Added changelog fragment
1 parent d870539 commit 46c158e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- windows setup - Added ``ansible_os_installation_type`` to denote the type of Windows installation the remote host is.

lib/ansible/modules/windows/setup.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,21 @@ if($gather_subset.Contains('distribution')) {
207207
default { "unknown" }
208208
}
209209

210+
$installation_type = $null
211+
$current_version_path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
212+
if (Test-Path -LiteralPath $current_version_path) {
213+
$install_type_prop = Get-ItemProperty -LiteralPath $current_version_path -ErrorAction SilentlyContinue
214+
$installation_type = [String]$install_type_prop.InstallationType
215+
}
216+
210217
$ansible_facts += @{
211218
ansible_distribution = $win32_os.Caption
212219
ansible_distribution_version = $osversion.Version.ToString()
213220
ansible_distribution_major_version = $osversion.Version.Major.ToString()
214221
ansible_os_family = "Windows"
215222
ansible_os_name = ($win32_os.Name.Split('|')[0]).Trim()
216223
ansible_os_product_type = $product_type
224+
ansible_os_installation_type = $installation_type
217225
}
218226
}
219227

0 commit comments

Comments
 (0)