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

Original Install Date not found in os info. #880

Open
liudonghua123 opened this issue Jan 9, 2024 · 2 comments
Open

Original Install Date not found in os info. #880

liudonghua123 opened this issue Jan 9, 2024 · 2 comments

Comments

@liudonghua123
Copy link

Is your feature request related to a problem? Please describe.

I want to found Original Install Date which means when the OS installed using this package. I can found this info from the output of command systeminfo execution.

I tried to execute npx systeminformation and not found such info in the output.

> npx systeminformation
...
  "os": {
    "platform": "Windows",
    "distro": "Microsoft Windows 11 Pro Education",
    "release": "10.0.22631",
    "codename": "",
    "kernel": "10.0.22631",
    "arch": "x64",
    "hostname": "LAPTOP-TP",
    "fqdn": "LAPTOP-TP",
    "codepage": "936",
    "logofile": "windows",
    "serial": "00380-00000-00001-AA229",
    "build": "22631",
    "servicepack": "0.0",
    "uefi": false,
    "hypervisor": true,
    "remoteSession": false
  },
...
> systeminfo

Host Name:                 LAPTOP-TP
OS Name:                   Microsoft Windows 11 Pro Education
OS Version:                10.0.22631 N/A Build 22631
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          Liu.D.H
Registered Organization:
Product ID:                00380-00000-00001-AA229
Original Install Date:     2022/10/8, 21:05:04
System Boot Time:          2024/1/8, 19:53:53
System Manufacturer:       LENOVO
System Model:              20KNA013CD
System Type:               x64-based PC
...

Describe the solution you'd like
Maybe parse the output of command systeminfo execution.

Describe alternatives you've considered
N/A

Additional context
N/A

@sebhildebrandt
Copy link
Owner

@liudonghua123 Currently this information is not available in the systeminformation package but this is a good idea! I will think of implementing it ... will let you know, when I have a solution.

@liudonghua123
Copy link
Author

I go through the code and found this line.

https://github.com/sebhildebrandt/systeminformation/blob/5c5efe269eb0eedcb985a3e4be14652e37e75a3b/lib/osinfo.js#L342C40-L342C40

I can get InstallDate from Get-CimInstance Win32_OperatingSystem.

> Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion,InstallDate


Caption                 : Microsoft Windows 11 Pro Education
SerialNumber            : 00380-00000-00001-AA229
BuildNumber             : 22631
ServicePackMajorVersion : 0
ServicePackMinorVersion : 0
InstallDate             : 2022/10/8 21:05:04


And for linux (maybe macos or more general *nix too), I can use stat command to get the installed date.

[root@localhost ~]# stat -c %w / 
2020-02-11 13:12:07.443813000 +0800
[root@localhost ~]# stat -c %w / | awk '{print $1}'
2020-02-11
[root@localhost ~]# 

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

No branches or pull requests

2 participants