win_setup: Add missing properties
We add some basic properties for Windows that are available on other platforms.
This commit is contained in:
parent
e2d6b8e288
commit
4081ab8a0a
1 changed files with 10 additions and 1 deletions
|
@ -54,6 +54,7 @@ if ($factpath -ne $null) {
|
||||||
|
|
||||||
$win32_os = Get-CimInstance Win32_OperatingSystem
|
$win32_os = Get-CimInstance Win32_OperatingSystem
|
||||||
$win32_cs = Get-CimInstance Win32_ComputerSystem
|
$win32_cs = Get-CimInstance Win32_ComputerSystem
|
||||||
|
$win32_bios = Get-CimInstance Win32_Bios
|
||||||
$osversion = [Environment]::OSVersion
|
$osversion = [Environment]::OSVersion
|
||||||
$capacity = $win32_cs.TotalPhysicalMemory # Win32_PhysicalMemory is empty on some virtual platforms
|
$capacity = $win32_cs.TotalPhysicalMemory # Win32_PhysicalMemory is empty on some virtual platforms
|
||||||
$netcfg = Get-WmiObject win32_NetworkAdapterConfiguration
|
$netcfg = Get-WmiObject win32_NetworkAdapterConfiguration
|
||||||
|
@ -81,13 +82,21 @@ Set-Attr $result.ansible_facts "ansible_interfaces" $formattednetcfg
|
||||||
|
|
||||||
Set-Attr $result.ansible_facts "ansible_architecture" $win32_os.OSArchitecture
|
Set-Attr $result.ansible_facts "ansible_architecture" $win32_os.OSArchitecture
|
||||||
|
|
||||||
Set-Attr $result.ansible_facts "ansible_hostname" $env:COMPUTERNAME;
|
# FIXME: Reformat the date to MM/DD/YEAR format
|
||||||
|
Set-Attr $result.ansible_facts "ansible_bios_date" $win32_bios.ReleaseDate
|
||||||
|
Set-Attr $result.ansible_facts "ansible_bios_version" $win32_bios.SMBIOSBIOSVersion
|
||||||
|
Set-Attr $result.ansible_facts "ansible_hostname" $env:COMPUTERNAME
|
||||||
Set-Attr $result.ansible_facts "ansible_fqdn" "$([System.Net.Dns]::GetHostByName((hostname)).HostName)"
|
Set-Attr $result.ansible_facts "ansible_fqdn" "$([System.Net.Dns]::GetHostByName((hostname)).HostName)"
|
||||||
|
Set-Attr $result.ansible_facts "ansible_product_name" $win32_cs.Model
|
||||||
|
Set-Attr $result.ansible_facts "ansible_product_serial" $win32_bios.SerialNumber
|
||||||
|
Set-Attr $result.ansible_facts "ansible_product_version" $win32_cs.Name
|
||||||
Set-Attr $result.ansible_facts "ansible_system" $osversion.Platform.ToString()
|
Set-Attr $result.ansible_facts "ansible_system" $osversion.Platform.ToString()
|
||||||
|
Set-Attr $result.ansible_facts "ansible_system_vendor" $win32_cs.Manufacturer
|
||||||
Set-Attr $result.ansible_facts "ansible_os_family" "Windows"
|
Set-Attr $result.ansible_facts "ansible_os_family" "Windows"
|
||||||
Set-Attr $result.ansible_facts "ansible_os_name" ($win32_os.Name.Split('|')[0]).Trim()
|
Set-Attr $result.ansible_facts "ansible_os_name" ($win32_os.Name.Split('|')[0]).Trim()
|
||||||
Set-Attr $result.ansible_facts "ansible_distribution" $osversion.VersionString
|
Set-Attr $result.ansible_facts "ansible_distribution" $osversion.VersionString
|
||||||
Set-Attr $result.ansible_facts "ansible_distribution_version" $osversion.Version.ToString()
|
Set-Attr $result.ansible_facts "ansible_distribution_version" $osversion.Version.ToString()
|
||||||
|
Set-Attr $result.ansible_facts "ansible_windows_domain" $win32_cs.Domain
|
||||||
|
|
||||||
$date = New-Object psobject
|
$date = New-Object psobject
|
||||||
Set-Attr $date "date" (Get-Date -format d)
|
Set-Attr $date "date" (Get-Date -format d)
|
||||||
|
|
Loading…
Reference in a new issue