10000 Use WMI in Get-Uptime on Windows by iSazonov · Pull Request #24644 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Use WMI in Get-Uptime on Windows #24644

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&rdquo 8000 ;, 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

Closed
wants to merge 1 commit into from

Conversation

iSazonov
Copy link
Collaborator
@iSazonov iSazonov commented Dec 5, 2024

PR Summary

Fix #24432

PR Context

The stopwatch has a significant drift in Windows over time so it is better use WMI request.

PR Checklist

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Dec 5, 2024
@jborean93
Copy link
Collaborator

Just as an FYI, WMI is typically not accessible for non-admins in a non-interactive session like ssh/PSRemoting.

@iSazonov
Copy link
Collaborator Author
iSazonov commented Dec 6, 2024

Payment for accuracy. :-)

Another official API I know (Get-CimInstance Win32_PerfFormattedData_PerfOS_System).SystemUpTime requires remote permissions too.
An unofficial way is to view the c:\pagefile.sys file time.

Do you know any other ways that we could use?

@jborean93
Copy link
Collaborator

I'm not aware of any but I've not really had a look before. I just know that in Ansible we've tried to reduce our use of WMI because it doesn't work on a network logon unless the user is an administrator. I guess it's a question here if the cmdlet should get the more accurate information at the cost of erroring in a PSRemoting session or whether it should have a fallback in case that fails.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Dec 16, 2024
@iSazonov
Copy link
Collaborator Author

We need more discuss in related issue.

@iSazonov iSazonov closed this Dec 25, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Dec 25, 2024
Copy link
Contributor
microsoft-github-policy-service bot commented Dec 25, 2024

📣 Hey @iSazonov, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get-Uptime is very slightly but increasingly inaccurate relative to Task Manager's up time
4 participants
0