Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: ansible_os_install_date fact #663

Closed
Yannik opened this issue Oct 2, 2024 · 3 comments · Fixed by #685
Closed

Feature request: ansible_os_install_date fact #663

Yannik opened this issue Oct 2, 2024 · 3 comments · Fixed by #685

Comments

@Yannik
Copy link

Yannik commented Oct 2, 2024

SUMMARY

I would really appreciate having a ansible_os_install_date fact. Managing more than 200 win servers with ansible, things sometimes need to be rolled out to newer servers first, before applying these changes to the older ones.

The OS Install date can be determined with:
Get-CimInstance Win32_OperatingSystem |Select-Object -ExpandProperty InstallDate

ISSUE TYPE
  • Bug Report
COMPONENT NAME

setup

@jborean93
Copy link
Collaborator

jborean93 commented Oct 28, 2024

Does this fact exist in another location like the registry. We are trying to avoid adding any extra calls to WMI/CIM because it slows the overall module down and non-admins cannot access this information.

It looks like it may be present on the InstallTime registry value

$osInfo = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name InstallTime
[DateTime]::FromFileTime($osInfo.InstallTime)

# Saturday, 15 June 2024 7:39:16 PM

Get-CimInstance Win32_OperatingSystem |Select-Object -ExpandProperty InstallDate

# Saturday, 15 June 2024 7:39:16 PM

@Yannik
Copy link
Author

Yannik commented Oct 29, 2024

@jborean93 Using InstallTime registry value seems good to me.

@Yannik
Copy link
Author

Yannik commented Oct 31, 2024

Thank you! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants